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

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -