File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
pyqt-calculator-tutorial/examples Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ # filename: dialog.py
2
+
3
+ """Dialog-Style application."""
4
+
5
+ import sys
6
+
7
+ from PyQt5 .QtWidgets import QApplication
8
+ from PyQt5 .QtWidgets import QDialog
9
+ from PyQt5 .QtWidgets import QLineEdit
10
+ from PyQt5 .QtWidgets import QVBoxLayout
11
+ from PyQt5 .QtWidgets import QFormLayout
12
+ from PyQt5 .QtWidgets import QDialogButtonBox
13
+
14
+
15
+ class Dialog (QDialog ):
16
+ """Dialog."""
17
+
18
+ def __init__ (self , parent = None ):
19
+ """Initializer."""
20
+ super ().__init__ (parent )
21
+ self .setWindowTitle ('QDialog' )
22
+ dlg_layout = QVBoxLayout ()
23
+ form_layout = QFormLayout ()
24
+ form_layout .addRow ('Name:' , QLineEdit ())
25
+ form_layout .addRow ('Age:' , QLineEdit ())
26
+ form_layout .addRow ('Job:' , QLineEdit ())
27
+ form_layout .addRow ('Hobbies:' , QLineEdit ())
28
+ dlg_layout .addLayout (form_layout )
29
+ btns = QDialogButtonBox ()
30
+ btns .setStandardButtons (QDialogButtonBox .Cancel | QDialogButtonBox .Ok )
31
+ dlg_layout .addWidget (btns )
32
+ self .setLayout (dlg_layout )
33
+
34
+
35
+ if __name__ == '__main__' :
36
+ app = QApplication (sys .argv )
37
+ dlg = Dialog ()
38
+ dlg .show ()
39
+ sys .exit (app .exec_ ())
You can’t perform that action at this time.
0 commit comments