Created
October 19, 2017 13:22
-
-
Save driscollis/753c5f69c5e641378862d7db9237bec0 to your computer and use it in GitHub Desktop.
Get mouse coordinates in wxPython
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import wx | |
| class MyFrame(wx.Frame): | |
| def __init__(self): | |
| wx.Frame.__init__(self, parent=None, title='Mouse Position') | |
| panel = wx.Panel(self) | |
| panel.Bind(wx.EVT_MOTION, self.on_mouse_movement) | |
| self.Show() | |
| def on_mouse_movement(self, event): | |
| print(event.GetPosition()) | |
| if __name__ == '__main__': | |
| app = wx.App(False) | |
| frame = MyFrame() | |
| app.MainLoop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment