From: Tony C. <cap...@gm...> - 2007-11-17 00:17:50
|
I've got 2 classes in my Pythoncard program. The GUI is handled in class1 and some file processing is handled in class2. Class2 executes an external program in a thread, and loops waiting for the thread to finish. In that loop, I call a method in class1 which calls wx.safeYield(). The external program is processing some text files, and the GUI lets the user choose which files to process and passes those files as args to the external program. While the gui is looping passing a new filename to the program, my Pythoncard GUI is unresponsive. That is, I cannot move it with the mouse, nor maximize/minimize it. Class1 passes a callback to class2 to allow class2 to execute a callback which calls wx.SafeYield. That callback can be seen below (guiCallback) This is the method in class2 which executes the external program, in a thread threadHandle = ManagedThread(ExecutePipedCommand, cmdLine) while not threadHandle.IsDone(): guiCallback() time.sleep(.10) ExecutePipedCommand() is just a wrapper class for os.popen() ManagedThread() is just a wrapper for the functionality in the threading module How should I proceed to keep my pythoncard gui from freezing? Thanks |