I've been trying this for a bit and haven't found a solution that works for me
I have a
Refactor your code such that what you are drawing in your
EVT_PAINT handler can be called passing it the
wx.DC to be drawn upon, and then call that from your paint handler with the
wx.PaintDC or whatever you are currently using. When you want to save it to an image call the same code passing a
wx.MemoryDC with a
wx.Bitmap selected into it. When it's done the bitmap will have the same contents as the window, and you can then save it to a file or whatever you need to do with it.