multithreading - PyQT classes e threads -


hy, i'm tryng write simple app pyqt display map thread class write text in "console" textbox, on main gui. when execute code i've following error: type object 'googlemapsexec' has no attribute 'console'

this code:

class modem(threading.thread):     def __init__(self, parent = none):         threading.thread.__init__(self, parent)      def run(self):         = "this thread"         googlemapsexe.console.settext(a)    class googlemapsexec(qdialog, ui_dialoggooglemaps):      def __init__(self, parent = none):         qdialog.__init__(self, parent)         self.setupui(self)         self.mapview.seturl(qtcore.qurl("map.com"))        #self.console.settext("line 1")      @pyqtsignature("")     def on_button_clicked(self):         t = modem()         t.start()   ##d = threading.thread(name='daemon', target=daemon) ##d.setdaemon(true)  if __name__ == "__main__":     import sys     app = qtgui.qapplication(sys.argv)     dialoggooglemaps = googlemapsexec()     dialoggooglemaps.show()     sys.exit(app.exec_()) 

what i'm not understanding? in advance!

  1. you need instantiate googlemapsexec before can call instance methods, source of exception eg. googlemapsexe().console.settext(a)
  2. more importantly, threading pyqt need pyqt's qthread, not python's threading module.

Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -