Dynamic Drawing with Cairo and wxPython

I would try a different approach. Make a cairo.ImageSurface and hold on to it, and when you want to draw something create a context for the surface and draw it there. If you want to get it out to the screen at that time then call the window's Refresh so there will be a paint event. When you get paint events create a context for the paint dc and then draw the image surface there. You should be able to do it all without wx.GraphicsContext by using pycairo and the helpers in the wx.lib.wxcairo module.

···

On 7/24/12 4:43 PM, Jeremy wrote:

In this code, what I want to accomplish is to make canvas.DrawRectangle
and have the ability to write to the canvas without the function being
called from within canvas.OnPaint.

--
Robin Dunn
Software Craftsman