Hello!
How can I convert from an event.GetPosition() to a FloatCanvas coordinate?
When I click the left mouse button, I would like to print the
coordinates in the
FloatCanvas canvas, and not the position in the window.
Oerjan...
###################################################
#!/usr/bin/env python
"""
This is a small test, to find out how to convert from
event.GetPosition() to FloatCanvas coordinates.
"""
import wx
import wx.lib.inspection
from wx.lib.floatcanvas import FloatCanvas
class MyFrame(wx.Frame):
""""""
def __init__(self, *args, **kwargs):
wx.Frame.__init__(self, *args, **kwargs)
# Add the Canvas
Canvas = FloatCanvas.FloatCanvas(self, -1, (500,500) ,
ProjectionFun = None, Debug = 0, BackgroundColor = "White")
self.Canvas = Canvas
Canvas.Bind(FloatCanvas.EVT_LEFT_DOWN, self.OnLeft)
def OnLeft(self, event):
# I would like to print the coordinates in the canvas, not the
position in the window.
print event.GetPosition()
class MyApp(wx.App):
def OnInit(self):
frame = MyFrame(None, -1, '30_fc_events.py')
frame.Show()
self.SetTopWindow(frame)
return 1
if __name__ == "__main__":
app = MyApp(0)
# wx.lib.inspection.InspectionTool().Show()
app.MainLoop()
_______________________________________________
FloatCanvas mailing list
[email protected]
http://paulmcnett.com/cgi-bin/mailman/listinfo/floatcanvas