I have got an application that renders an image in a separate thread and when the rendering is done, this thread should open a wxFrame showing the rendered image. Under Linux everything works fine (as usually in my questions ;-)) but under Win the wxFrame pops up for a short moment and the disappears. Is there a fix for this?
I could reduce the problem to a minimum (see attached file Threadmain.py): This litle app starts a separate thread if you press the button, does some output to the TextCtrl and shows a wxFrame with a button afterwards.
I have got an application that renders an image in a separate thread and when the rendering is done, this thread should open a wxFrame showing the rendered image. Under Linux everything works fine (as usually in my questions ;-)) but under Win the wxFrame pops up for a short moment and the disappears. Is there a fix for this?
I could reduce the problem to a minimum (see attached file Threadmain.py): This litle app starts a separate thread if you press the button, does some output to the TextCtrl and shows a wxFrame with a button afterwards.
On Windows the thread that creates a window owns the window, and so when your thread exits the window is destroyed along with it.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
I have got an application that renders an image in a separate thread and when the rendering is done, this thread should open a wxFrame showing the rendered image. Under Linux everything works fine (as usually in my questions ;-)) but under Win the wxFrame pops up for a short moment and the disappears. Is there a fix for this?
I could reduce the problem to a minimum (see attached file Threadmain.py): This litle app starts a separate thread if you press the button, does some output to the TextCtrl and shows a wxFrame with a button afterwards.
On Windows the thread that creates a window owns the window, and so when your thread exits the window is destroyed along with it.
You really shouldn't do GUI stuff from the non-gui thread, even when using the gui mutex, (unless there is really no other way to solve a particular problem.) The alternative is to use wxCallAfter from your alternate thread to cause the gui code to be invoked in the context of the gui thread.