how to save the contents on dc to a local pic file?

Use wx.MemoryDC
the MemoryDC is created using an Bitmap and all the drawings are contained into this bitmap.
You can save the bitmap in PNG format.

Peter

···

On Tue, Apr 15, 2008 at 10:28 AM, oyster lepto.python@gmail.com wrote:

As we know, there is a samples\doodle\superdoodle.py with wxpython. It

can save its native file format, but what if I want to save my drawing

to a PNG/JPG file?

I have read the src, but find 2 aspects which block me:

  1. ‘dc’ is not saved as class var,

  2. even if I get dc, I don’t know how to save it to file.

Any hints? thanx in advance.


wxpython-users mailing list

wxpython-users@lists.wxwidgets.org

http://lists.wxwidgets.org/mailman/listinfo/wxpython-users


There is NO FATE, we are the creators.

Peter Damoc wrote:

Use wx.MemoryDC
the MemoryDC is created using an Bitmap and all the drawings are contained into this bitmap.
You can save the bitmap in PNG format.

In the superdoodle sample it is even easier. It's already using a bitmap to double buffer the drawing, so that bitmap already contains a copy of what you see on screen. So all you have to do is take self.buffer and call it's SaveFile method.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!