# w2wx.py3 needs wx for Windows import wx import sys class MyFrame(wx.Frame): def __init__(self, parent): # -1 is the default ID wx.Frame.__init__(self, parent, -1, "w2wx.py connect points", size=(400,400), style=wx.DEFAULT_FRAME_STYLE) self.SetBackgroundColour('white') self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown) self.Bind(wx.EVT_RIGHT_DOWN, self.OnRightDown) def OnLeftDown(self, event): """left mouse button is pressed""" pt = event.GetPosition() # position tuple print("left down ", pt) def OnRightDown(self, event): """right mouse button is pressed""" pt = event.GetPosition() print ("right down ", pt) app = wx.App() frame = MyFrame(None) frame.Show(True) print("w2wx.py3 running") app.MainLoop()