Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PyQt5.QtWidgets import *
- import sys
- app = QApplication(sys.argv)
- w = QDialog()
- lay = QGridLayout()
- lbl = QLabel("Username:")
- lay.addWidget(lbl,0,0)
- lbl = QLabel("Password:")
- lay.addWidget(lbl,1,0)
- txtUsername = QLineEdit()
- lay.addWidget(txtUsername,0,1,1,2)
- txtPassword = QLineEdit()
- txtPassword.setEchoMode(QLineEdit.Password)
- lay.addWidget(txtPassword,1,1,1,2)
- def cmdOK(checked):
- w.done(100)
- def cmdCancel(checked):
- w.done(100)
- btn = QPushButton("OK")
- btn.clicked.connect(cmdOK)
- lay.addWidget(btn,2,1)
- btn = QPushButton("Cancel")
- btn.clicked.connect(cmdOK)
- lay.addWidget(btn,2,2)
- w.setLayout(lay)
- r = w.exec()
- print(f"Po show z {r}")
- if r == 100:
- print(f"Tworze uzytkownia {txtUsername.text()} z haslem {txtPassword.text()}")
- else:
- print(f"Anulowano operacje tworzenia uzytkownika")
- app.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement