Multithreading PyQT类e线程
Hy, 我正在尝试用PyQT编写一个简单的应用程序,它基本上显示了一个映射,线程类将在主GUI上的“控制台”(一个文本框)中写入一些文本。 当我执行代码时,出现以下错误: 类型对象“GoogleMapsExec”没有属性“console” 这是我的代码:Multithreading PyQT类e线程,multithreading,class,pyqt4,Multithreading,Class,Pyqt4,Hy, 我正在尝试用PyQT编写一个简单的应用程序,它基本上显示了一个映射,线程类将在主GUI上的“控制台”(一个文本框)中写入一些文本。 当我执行代码时,出现以下错误: 类型对象“GoogleMapsExec”没有属性“console” 这是我的代码: class Modem(threading.Thread): def __init__(self, parent = None): threading.Thread.__init__(self, parent)
class Modem(threading.Thread):
def __init__(self, parent = None):
threading.Thread.__init__(self, parent)
def run(self):
a = "this is a 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_())
我不明白什么?提前谢谢
GoogleMapsExe().console.setText(a)