I am programming in python 2.6 from repo and I am attempting to thread my gui using OyQt4.
When I did a Tk GUI I was able to run the GUI in a separate thread no problem, but when I try to do the same with QT I get errors.
Is my supposition that Qt4 will only run from the Main thread?
Code:
import os
import pickle
import sys
import threading
import time
import SW_CharacterX
import SW_CombatX
import SW_CharacterCreator
#Qt gui boilerplate
from PyQt4 import QtGui, QtCore
import SW_Gui_Qt
class ThaThread ( threading.Thread ):
def run ( self ):
#RUN CHARACTER CREATOR
SW_CharacterCreator.main()
#RUN COMBAT
SW_CombatX.Combat()
def main():
#Again, Qt boilerplate...
app = QtGui.QApplication(sys.argv)
window = SW_Gui_Qt.MainWindow()
window.show()
sys.exit(app.exec_())
return(0)
if __name__ == '__main__':
try:
ThaThread().start()
except:
print ("NO THREADING AVAILABLE")
import sys
sys.exit(1)
main()
main
Is this the only way to do this or is there a better way?
Thank you in advance!
Bookmarks