wxPython blocks in thread?
Arnaud de La Fortelle
Arnaud.De_La_Fortelle at inria.fr
Wed Feb 27 13:08:44 EST 2002
I am a beginner with wxPython and tried to embed a GUI within a
thread. So I came with a simple implementation, but it does not work.
I do not understand why the following application blocks. What the
matter?
Arnaud
from wxPython.wx import *
class MyApp(wxApp):
def OnInit(self):
frame = wxFrame(NULL, -1, "It blocks!")
frame.Show(true)
self.SetTopWindow(frame)
return true
import threading
class GUIThread(threading.Thread,object):
def __init__(self):
threading.Thread.__init__(self,target=self.loop)
self.start()
def loop(self):
print gui_thr
self.app = MyApp(0)
self.app.MainLoop() # if I comment out this line, it works
print "Ending wxLoop", self.isAlive()
gui_thr=GUIThread()
print "Ending Main thread"
More information about the Python-list
mailing list