Thread updating GUI

Cliff Wells LogiplexSoftware at earthlink.net
Wed Dec 18 10:50:43 EST 2002


On Wed, 2002-12-18 at 01:04, Anand B Pillai wrote:
> This is a wxPython question. Anyway since I am using python threads I
> shall rather post it here.
> 
>  I am trying to update a bitmap embedded in a wxPanel using a separate
> thread
> subclassed from Thread class in module threading. The basic idea is to
> run the
> thread and let it run a slideshow by changing images on the panel. 

Anand,

If you check out the current CVS of wxPython, there is a control
(throbber) that does pretty much what you are trying to do (in fact, if
you set the delay on it high enough, you'd have exactly what you're
looking for).   There is also a demo of it in the wxPython demo (from
CVS).

The basic problem you are facing is that you can't update the UI
directly from a thread.  All wxPython GUI updates must be from within
the same thread as the wxApp.  The solution is to post an event and have
an event handler that does the drawing.

Regards,

-- 
Cliff Wells, Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308  (800) 735-0555 x308





More information about the Python-list mailing list