-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpassworddlg.py
35 lines (27 loc) · 1.01 KB
/
passworddlg.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
from PyQt4.QtCore import *
from PyQt4.QtGui import *
class PasswordDlg(QDialog):
def __init__(self, parent=None):
super(PasswordDlg, self).__init__(parent)
passwordLabel = QLabel("&Password:")
self.passwordEdit = QLineEdit()
passwordLabel.setBuddy(self.passwordEdit)
self.passwordEdit.setEchoMode(QLineEdit.Password)
buttonBox = QDialogButtonBox(QDialogButtonBox.Ok|
QDialogButtonBox.Cancel)
layout = QGridLayout()
layout.addWidget(passwordLabel, 0, 0)
layout.addWidget(self.passwordEdit, 0, 1)
layout.addWidget(buttonBox, 1, 0, 1, 2)
self.setLayout(layout)
buttonBox.accepted.connect(self.accept)
buttonBox.rejected.connect(self.reject)
self.setWindowTitle("Set Server Password")
def result(self):
return self.passwordEdit.text()
if __name__ == "__main__":
import sys
app = QApplication(sys.argv)
form = PasswordDlg()
form.show()
app.exec_()