I think so.
I create an instance of a class which inherits QThread, in the initializer of the mainwindow, and store that instance in a variable in the mainwindow class, so the pseudo code would be
class myThread(QThread):
def __init__(self):
QThread.__init__(self)
def run(self):
x=0
while x != progBarMax:
progressBar.setValue(x)
x+=1
class myInterface(QMainWindow, UIModule.My_UI):
def __init__(self, parent=None):
super(myInterface, self).__init__(parent)
self.setupUI(self)
self.interface = myThread()
@pyqtSignature("")
def on_button_clicked(self):
self.interface.start()
class myThread(QThread):
def __init__(self):
QThread.__init__(self)
def run(self):
x=0
while x != progBarMax:
progressBar.setValue(x)
x+=1
class myInterface(QMainWindow, UIModule.My_UI):
def __init__(self, parent=None):
super(myInterface, self).__init__(parent)
self.setupUI(self)
self.interface = myThread()
@pyqtSignature("")
def on_button_clicked(self):
self.interface.start()
To copy to clipboard, switch view to plain text mode
Bookmarks