forked from johri-lab/Automatic-leaf-infection-identifier
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GUIdriver.py
36 lines (24 loc) · 897 Bytes
/
GUIdriver.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import sys
from PyQt5 import QtCore, QtGui, QtWidgets, uic
qtCreatorFile = "design.ui" # Enter file here.
global ImageFile
Ui_MainWindow, QtBaseClass = uic.loadUiType(qtCreatorFile)
class MyApp(QtWidgets.QMainWindow, Ui_MainWindow):
def __init__(self):
QtWidgets.QMainWindow.__init__(self)
Ui_MainWindow.__init__(self)
self.setupUi(self)
self.browse.clicked.connect(self.Test)
self.close.clicked.connect(self.Close)
def Test(self):
options = QtWidgets.QFileDialog.Options()
options |= QtWidgets.QFileDialog.DontUseNativeDialog
ImageFile = QtWidgets.QFileDialog.getOpenFileName(self,"Select Image To Process", "","All Files (*);;Image Files(*.jpg *.gif)",options=options)[0]
exec(open('main.py').read())
def Close(self):
self.destroy()
if __name__ == "__main__":
app = QtWidgets.QApplication(sys.argv)
window = MyApp()
window.show()
sys.exit(app.exec_())