hello
I need to draw over image (to comment over it) in a scrolled panel. I'm having troubles with it since it doesn't behave right when I zoom it in or out. it stops drawing , and then it shows it after a while in a wrong place. right in the upper left corner of the window. and doesn't draw lines correctly .
below is the code for the (onLeftDown
) function (the button that should draw). the right button event (zoom in). hope it is clear enough.
do you guys have any idea what is going on, and how do I solve it?
thanks in advance
def OnLeftButtonEvent(self, event):
self.curLine = []
self.x, self.y = event.GetPositionTuple()
self.CaptureMouse()
def OnMotion(self, event):
if self.HasCapture() and event.Dragging():
dc = wx.BufferedDC(None,self.buffer)
dc.SetUserScale(self.scale,self.scale)
# to zoom in and out ( increases whenever someone presses the right mouse button
dc.BeginDrawing()
dc.SetPen(wx.Pen(wx.BLUE, 3))
coords = (self.x, self.y) + event.GetPositionTuple()
self.curLine.append(coords)
dc.DrawLine(*coords)
self.x, self.y = event.GetPositionTuple()
self.SetXY(event)
dc.EndDrawing()
def OnRightDown(self,event):
print self.scale
self.scale=self.scale*2.0
self.initDrawing()
self.maxHeight=self.maxHeight*2
self.maxWidth=self.maxWidth*2