[wxPython] saving window contents to image file?

Hello,

Is there an easy way to dump the contents of a window into a wxImage so that
it can be saved as a .png .jpeg, etc. file? I have some plots in a window
I'd like to save as images.

thanks,
eric

Is there an easy way to dump the contents of a window into a wxImage so

that

it can be saved as a .png .jpeg, etc. file? I have some plots in a window
I'd like to save as images.

Create a wxBitmap and a wxMemoryDC that selects that bitmap. Then either
redraw your plot into the memory DC, or Blit from a wxClientDC of the window
to the memoryDC. Then unselect the bitmap from the memory dc and create
your wxImage with wxImageFromBitmap(bmp).

ยทยทยท

--
Robin Dunn
Software Craftsman
robin@AllDunn.com
http://wxpython.org Java give you jitters?
http://wxpros.com Relax with wxPython!