This is related to Cairo and double buffer example at here:
http://wiki.wxpython.org/DoubleBufferedDrawing
Replace the "draw" function with this
def Draw(self, dc):
dc.SetBackground( wx.Brush("White") )
dc.Clear() # make sure you clear the bitmap!
# Set global scale and translation
dc.SetUserScale(1.5, 1.5)
dc.SetDeviceOrigin(50, 50)
# now draw something with cairo
ctx = Cr.GraphicsContext.Create(dc) # wx.GCDC(dc) # This
works!!!
ctx.SetBrush(wx.Brush("blue"))
ctx.DrawEllipse(0,0,100,50)
# Reset global scale and translation
dc.SetUserScale(1, 1)
dc.SetDeviceOrigin(0, 0)
Just before rendering on cairo I am setting up global scale/zoom and
translation. Ellipse is rendered as it has been scaled as bitmap not a
proper scaled shape.
This works if fine you use wx.GCDC instead of cairo by changing the
line
ctx = Cr.GraphicsContext.Create(dc)
to
ctx = wx.GCDC(dc)
How to set global scale & translation in and cairo before you draw
anything?
Prashant
Python 2.6.2
wxPython 2.8.10.1
Win XP 32