-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGUI.py
49 lines (31 loc) · 1005 Bytes
/
GUI.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/python
"""
This class creates the main
window of the (heart_gui)
"""
import sys
from PyQt4 import QtGui
class Gui(QtGui.QMainWindow):
def __init__(self):
super(Gui, self).__init__()
self.initUI()
def openFile(self):
fname = QtGui.QFileDialog.getOpenFileName(self, 'Open File', '/home/antoine/')
return fname
def initUI(self):
exitAction = QtGui.QAction(QtGui.QIcon('exit.png'), '&exit', self)
exitAction.triggered.connect(QtGui.qApp.quit)
openAction = QtGui.QAction(QtGui.QIcon(''), '&open', self)
openAction.triggered.connect(self.openFile)
menuBar = self.menuBar()
fileMenu = menuBar.addMenu('&File')
fileMenu.addAction(openAction)
fileMenu.addAction(exitAction)
self.setWindowTitle('heart_gui')
self.showMaximized()
def main():
app = QtGui.QApplication(sys.argv)
gui = Gui()
sys.exit(app.exec_())
if __name__=='__main__':
main()