Retrieving text from password field [python][pyqt4]
- by Dr. Johnson
def welcomeStage (self):
self.test = QtGui.QLineEdit (self)
self.test.move (50, 150)
QtCore.QObject.connect (self.test, QtCore.SIGNAL ('returnPressed()'), self.passwordStage)
def passwordStage (self):
self.email = self.test.text()
self.test.clear()
self.test.setEchoMode (QtGui.QLineEdit.Password)
QtCore.QObject.connect (self.test, QtCore.SIGNAL ('returnPressed()'), self.loginStage)
def loginStage (self):
self.pwd = self.test.text()
print self.pwd
if len (self.pwd) < 0:
welcomeStage ()
return
Simply put, I am making a login form. The user enters their email, then the text field is cleared and echo mode is set to Password mode. The text() function returns the email fine, but when I call text() after I have changed the echo mode, it returns 0. I've been pouring over the documentation looking for anything regarding the text() function and how it operates when Password mode is on, however I have not found anything. Does anybody know how this is done?