i'm trying use variable 1 class in another, error, "run() missing 1 required positional argument: 'mywindowclass'"
class taskthread(qtcore.qthread): updateprogresssignal = qtcore.pyqtsignal(int) def run(self, mywindowclass): in range(101): self.updateprogresssignal.emit(i) print ( mywindowclass.pbtimeupdate ) time.sleep(mywindowclass.pbtimeupdate) class mywindowclass(qtgui.qdialog ): def __init__(self, *args): super(mywindowclass, self).__init__(*args) self.pbtimeupdate = .2 self.mylongtask = taskthread() self.mylongtask.updateprogresssignal.connect (self.onprogress) self.mylongtask.start() def onprogress (self, val ) print (val)
i've tried making variable global (declared outside both classes in same file), updating variable value in in 1 class, other class still sees original value)
what issue?
this should work:
class mywindowclass(qtgui.qdialog): pbtimeupdate = .2 class taskthread(qtcore.qthread): updateprogresssignal = qtcore.pyqtsignal(int) def run(self): in range(101): self.updateprogresssignal.emit(i) print(mywindowclass.pbtimeupdate) time.sleep(mywindowclass.pbtimeupdate)