self.Bind(wx.EVT_PAINT, self.OnPaint)
- # make a DC to draw into...
- self.buffer = wx.EmptyBitmap(w, h)
- self.dc = wx.BufferedDC(None, self.buffer)
-
- # Because we want the position of the mouse pointer
- # relative to the center of the canvas
+ # Have a reference DC with the desired coordinate system.
+ # Because we want the position of the mouse pointer relative to the
+ # center of this canvas.
+ self.dc = wx.MemoryDC(wx.EmptyBitmap(w, h))
self.dc.SetDeviceOrigin(w/2., h/2.)
self.draw_grid = True