Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.05 KB | None | 0 0
  1. from PyQt4.QtGui import *
  2. from PyQt4.QtCore import *
  3.  
  4.  
  5. class user_password(QWidget):
  6.     def __init__(self):
  7.         self.app = QApplication([])
  8.         self.win = QWidget()
  9.         self.main_layout = QVBoxLayout(self.win)
  10.         self.form = QFormLayout()
  11.    
  12.         self.u_label = QLabel('User:')
  13.         self.p_label = QLabel('Password:')
  14.         self.u_edit = QLineEdit()
  15.         self.p_edit = QLineEdit()
  16.         self.ok = QPushButton('Submit')
  17.    
  18.         self.win.setWindowTitle('What\'s your password?')
  19.         self.u_edit.setEchoMode(0)
  20.         self.p_edit.setEchoMode(2) # password = asterisks
  21.    
  22.         self.form.addRow(self.u_label, self.u_edit)
  23.         self.form.addRow(self.p_label, self.p_edit)
  24.         self.main_layout.addLayout(self.form)
  25.         self.main_layout.addWidget(self.ok)
  26.    
  27.         #self.ok.clicked.connect(self.print_values)
  28.         self.connect(self.ok, SIGNAL('clicked()'), self.print_values)
  29.    
  30.         self.win.show()
  31.         self.app.exec_()
  32.        
  33.     def print_values(self):
  34.         print 'foo'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement