python - Basic Widget Interaction with PyQt -
please can tell me im doing wrong here respect calling pwtxt.text.
#!/usr/bin/python import sys pyqt4 import qtcore, qtgui mainwindow import ui_mainwindow class myform(qtgui.qmainwindow): def __init__(self, parent=none): qtgui.qwidget.__init__(self, parent) self.ui = ui_mainwindow() self.ui.setupui(self) def on_pwextract_pressed(self): print self.pwtxt.text if __name__ == "__main__": app = qtgui.qapplication(sys.argv) myapp = myform() myapp.show() sys.exit(app.exec_())
the line print self.pwtxt.text
fails because can't find widget, pwtxt qlineedit defined on main window. made in qtdesigner , generated python code pyuic4.
how correctly reference other widgets on same window, in case want text qlineedit named pwtxt when qpushbutton pwextract pressed.
thanks lot.
try:
print self.ui.pwtxt.text()
Comments
Post a Comment