-
Notifications
You must be signed in to change notification settings - Fork 122
/
dialog.py
35 lines (29 loc) · 1.01 KB
/
dialog.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
"""Dialog-Style application."""
import sys
from PyQt5.QtWidgets import QApplication
from PyQt5.QtWidgets import QDialog
from PyQt5.QtWidgets import QDialogButtonBox
from PyQt5.QtWidgets import QFormLayout
from PyQt5.QtWidgets import QLineEdit
from PyQt5.QtWidgets import QVBoxLayout
class Dialog(QDialog):
def __init__(self, parent=None):
super().__init__(parent)
self.setWindowTitle("QDialog")
dlgLayout = QVBoxLayout()
formLayout = QFormLayout()
formLayout.addRow('Name:', QLineEdit())
formLayout.addRow('Age:', QLineEdit())
formLayout.addRow('Job:', QLineEdit())
formLayout.addRow('Hobbies:', QLineEdit())
dlgLayout.addLayout(formLayout)
btns = QDialogButtonBox()
btns.setStandardButtons(
QDialogButtonBox.Cancel | QDialogButtonBox.Ok)
dlgLayout.addWidget(btns)
self.setLayout(dlgLayout)
if __name__ == "__main__":
app = QApplication(sys.argv)
dlg = Dialog()
dlg.show()
sys.exit(app.exec_())