Advertisement
here2share

# Tk_mouse_xy.py

Sep 12th, 2015
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.28 KB | None | 0 0
  1. # Tk_mouse_xy.py
  2.  
  3. from Tkinter import *
  4.  
  5. root = Tk()
  6. def key(event):
  7.     root.event_generate('<Motion>', warp=True, x=50, y=50)
  8.  
  9. def motion(event):
  10.     print('x = {}, y = {}'.format(event.x, event.y))
  11.  
  12. root.bind('<Key>', key)
  13. root.bind('<Motion>', motion)
  14. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement