Another question about bitmaps

I'm still struggling with putting a bitmap on a panel, and then giving the user a mechanism to zoom in / zoom out. So far, I've contructed a "popup" window (wx.Frame) that contains a panel on which the bitmap should be drawn. The panel also contains a slider which is supposed to let the user increase or decrease the size of the bitmap (for instance, a photo).

I've not been able to get PaintDC or ScreenDC to work effectively. A staticbitmap is not so flexible. PIL provides a .resize() function that returns another bitmap, but integrating wxPyton and PIL is not easy.

Suggestions?

Thanks.
Brian

Hi Brian,

I'm still struggling with putting a bitmap on a panel, and then giving
the user a mechanism to zoom in / zoom out. So far, I've contructed a
"popup" window (wx.Frame) that contains a panel on which the bitmap
should be drawn. The panel also contains a slider which is supposed to
let the user increase or decrease the size of the bitmap (for instance,
a photo).

I've not been able to get PaintDC or ScreenDC to work effectively. A
staticbitmap is not so flexible. PIL provides a .resize() function that
returns another bitmap, but integrating wxPyton and PIL is not easy.

The handler you want to implement is an OnPaint method which tkes care
of the wx.EVT_PAINT event, plus some other things. Please try the
attached file: it's not a complete application (it doesn't work as-is
out of the box), but it should get you started.
It has zoom capabilities (via mouse-wheel), shadows beneath images
(generated using PIL) and other goodies. It's taken directly from my
software "InfinImage", and it uses a wx.ScrolledWindow to display the
image, drawing it in the OnPaint event handler.

HTH.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

ScrolledImage.py (8.77 KB)

···

On 6/30/07, Brian Wolf wrote:

WorkingWithImages - wxPyWiki has some useful conversion functions on it.

HTH, Phil

···

At 03:18 PM 6/29/2007, Brian wrote:

I've not been able to get PaintDC or ScreenDC to work effectively. A staticbitmap is not so flexible. PIL provides a .resize() function that returns another bitmap, but integrating wxPyton and PIL is not easy.

Suggestions?