On May 1, 12:12 am, Soumen banerjee <soume...@gmail.com> wrote: > Hello, > Im not adding any GUI elements from the changer thread. Im just > attempting to change the value of a preexisting widget made in thread > one. The point is that i need to display text generated in thread 2 in > a GUI generated in thread 1. > As far as inter thread synchronization is concerned, i see your point. > So i took this approach > > import wx,gui,threading > fix=0 > i=1 > class guithread(threading.Thread): > def run(self): > global fix > app = wx.PySimpleApp(0) > wx.InitAllImageHandlers() > guithread.frame_1 = gui.MyFrame(None, -1, "") > app.SetTopWindow(guithread.frame_1) > guithread.frame_1.Show() > print "setting fix" > fix=1 > app.MainLoop() > gui1=guithread() > gui1.start() > class changer(threading.Thread): > def run(self): > print fix > gui1.frame_1.text_ctrl_1.SetValue("hello") > print fix > while i: > if fix == 1: > print "starting changer" > chang=changer() > chang.start() > i=0 > This works, but is there anything simpler? > Regards > Soumen
For additional ideas on using threads in wxPython, see the wiki: http://wiki.wxpython.org/LongRunningTasks - Mike -- http://mail.python.org/mailman/listinfo/python-list