-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathminimal_pyqt.py
More file actions
executable file
·33 lines (25 loc) · 1003 Bytes
/
minimal_pyqt.py
File metadata and controls
executable file
·33 lines (25 loc) · 1003 Bytes
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
#!/usr/bin/env python3
# minimal qt application that show empty window (with title)
## need sys.exit() and sys.argv
import sys
## using PyQt
from PyQt4 import QtGui
################################################################################
## the only window class derived form QWidget
################################################################################
class Window(QtGui.QWidget):
pass
## init aka constructor of the widget
## it is a good idea to pass default parameter to base class
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
## set title text
self.setWindowTitle('Hello Qt')
################################################################################
## program entry-point, using python trick __name__
################################################################################
if __name__ == '__main__':
app = QtGui.QApplication(sys.argv)
window = Window()
window.show()
sys.exit(app.exec())