[wxPython-users] control for displaying multiple images

Christopher Barker Chris.Barker at noaa.gov
Mon May 21 11:23:47 PDT 2007


Andrea Gavana wrote:
> Try this piece of code, taken from the InfinImage implementation (it 
> requires PIL, Python Image Library).

Why PIL? I now it is pretty capable, but wxImage does everything you 
need for this -- is PIL faster or better quality?

Ryan Krauss wrote:
> I also added to
> the OnSize method to make it auto-resize the picture to fill the
> available space, but I commented these lines back out because it makes
> the resize event slow and a little choppy.

The issue here is that some systems give a Size event every couple of 
pixel moves of the mouse as you re-size frames -- the ideas is that app 
keeps updating itself while in the re-size process. Nifty, but ugly if 
re-painting to new size takes any time, as you've seen. I think you can 
turn that off in Windows and certainly Linux, but that requires the user 
to change their settings.

A better solution is to set off a wx.Timer when you get a Size event, 
then keep resetting it each event. Only when the Timer finishes (maybe 
about 0.1 or 0.2 seconds), i.e. when the user has stopped moving, do you 
actually do the re-size.

There is an implementation of this in wx.lib.floatcanvas.FloatCanvas.py, 
if you want to take a look.

-Chris

PS: This is looking nice -- maybe you can merge back with Andrea's code, 
and post it up with all of his other great stuff.



-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov




More information about the wxpython-users mailing list