File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
pyqt-calculator-tutorial/examples Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change
1
+ # filename: hello.py
2
+
3
+ """Simple Hello World example with PyQt5."""
4
+
5
+ import sys
6
+
7
+ # 1. Import `QApplication`, and all the required widgets
8
+ from PyQt5 .QtWidgets import QApplication
9
+ from PyQt5 .QtWidgets import QWidget
10
+ from PyQt5 .QtWidgets import QLabel
11
+
12
+ # 2. Create an instance of QApplication
13
+ app = QApplication (sys .argv )
14
+
15
+ # 3. Create an instance of your application's GUI
16
+ window = QWidget ()
17
+ window .setWindowTitle ('PyQt5 App' )
18
+ window .setGeometry (100 , 100 , 280 , 80 )
19
+ window .move (60 , 15 )
20
+ helloMsg = QLabel ('<h1>Hello World!</h1>' , parent = window )
21
+ helloMsg .move (60 , 15 )
22
+
23
+ # 4.Show your application's GUI
24
+ window .show ()
25
+
26
+ # 5. Run your application's event loop (or main loop)
27
+ sys .exit (app .exec_ ())
You can’t perform that action at this time.
0 commit comments