ANN: ThumbnailCtrl For wxPython ;-)

Richard Terry wrote:
> some feedback, unsure why but....
>
> run thumbs.py whilst in a network folder on my file server with

jpegs,

>
> ie python /home/richard/thumbs.py
> recieved an error message which from memory went something like

xlib...error

> with asyncronous something or other at [hex address].

This usually means that there is a GUI call in the context of a non-

main

thread.

mystery solved, unfortunately this also means that I'm screwed.
You know how sometimes something feels like a sin even if you don't
know why? I felt it and still... I did it anyway :slight_smile:

There is a threading.Thread that keeps a reference to the control and
pushes events in the event loop... it felt silly when I did it... still
feels....

Can someone take a look at the code and maybe suggest some way of
fixing this?

What I need is a mechanism of signaling between 2 threads, the working,
background thread that creates the thumbnail and the main wxPython GUI
thread. Right now I put things in a queue to ferry them to the working
thread and an event to get things from the working thread back into the
main thread.

Peter

Just a doubt. In the OnPaint method shouldn't we have a wx.PaintDC
insted of a wxMemoryDC?

Ricardo

···

On Fri, 2005-12-16 at 16:41 -0600, Peter Damoc wrote:

> Richard Terry wrote:
> > some feedback, unsure why but....
> >
> > run thumbs.py whilst in a network folder on my file server with
jpegs,
> >
> > ie python /home/richard/thumbs.py
> > recieved an error message which from memory went something like
xlib...error
> > with asyncronous something or other at [hex address].
>
> This usually means that there is a GUI call in the context of a non-
main
> thread.

mystery solved, unfortunately this also means that I'm screwed.
You know how sometimes something feels like a sin even if you don't
know why? I felt it and still... I did it anyway :slight_smile:

There is a threading.Thread that keeps a reference to the control and
pushes events in the event loop... it felt silly when I did it... still
feels....

Can someone take a look at the code and maybe suggest some way of
fixing this?

That should work. How are you pushing that event from the working thread to
the main thread? wx.CallAfter is the easiest option.

-Chris

···

On Friday 16 December 2005 2:41 pm, Peter Damoc wrote:

There is a threading.Thread that keeps a reference to the control and
pushes events in the event loop...

What I need is a mechanism of signaling between 2 threads, the working,
background thread that creates the thumbnail and the main wxPython GUI
thread. Right now I put things in a queue to ferry them to the working
thread and an event to get things from the working thread back into the
main thread.

--
Christopher Barker, Ph.D.
Oceanographer
                                        
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

Or maybe where Peter have:
self.control.GetEventHandler().ProcessEvent(evt)

change to:
self.control.GetEventHandler().AddPendingEvent(evt)

Ricardo

···

On Fri, 2005-12-16 at 15:04 -0800, Christopher Barker wrote:

On Friday 16 December 2005 2:41 pm, Peter Damoc wrote:

> There is a threading.Thread that keeps a reference to the control and
> pushes events in the event loop...

> What I need is a mechanism of signaling between 2 threads, the working,
> background thread that creates the thumbnail and the main wxPython GUI
> thread. Right now I put things in a queue to ferry them to the working
> thread and an event to get things from the working thread back into the
> main thread.

That should work. How are you pushing that event from the working thread to
the main thread? wx.CallAfter is the easiest option.