-
Notifications
You must be signed in to change notification settings - Fork 0
/
app_23.py
43 lines (36 loc) · 1.14 KB
/
app_23.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
import sys
from PySide.QtGui import QWidget, QFormLayout, QApplication, QLabel, QLineEdit
class MainWindow(QWidget):
""" Our Main Window class
"""
def __init__(self):
""" Constructor Function
"""
QWidget.__init__(self)
self.setWindowTitle("Form Layout")
self.setGeometry(300, 250, 400, 300)
def SetLayout(self):
formLayout = QFormLayout(self)
labelUsername = QLabel("Username")
txtUsername = QLineEdit()
labelPassword = QLabel("Password")
txtPassword = QLineEdit()
formLayout.addRow(labelUsername, txtUsername)
formLayout.addRow(labelPassword, txtPassword)
self.setLayout(formLayout)
if __name__ == '__main__':
# Exception Handling
try:
# QApplication.setStyle('plastique')
myApp = QApplication(sys.argv)
mainWindow = MainWindow()
mainWindow.SetLayout()
mainWindow.show()
myApp.exec_()
sys.exit(0)
except NameError:
print("Name Error:", sys.exc_info()[1])
except SystemExit:
print("Closing Window...")
except Exception:
print(sys.exc_info()[1])