A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-April/035149.html below:

[Python-Dev] Getting mouse position interms of canvas unit.

[Python-Dev] Getting mouse position interms of canvas unit.perl lover hemanexp@yahoo.com
Mon, 28 Apr 2003 07:40:41 -0700 (PDT)
hi,
  iam new to python and tkinter. I have created a
canvas of size 300m * 300m (in millimeter). I bind
mouse move method to canvas. when i move the mouse
over the canvas the mouse position gets printed in
pixel unit. But i want to get mouse position values
interms of canvas unit (ie, millimeter). How can i get
mouse position values interms of canvas unit?

   My program is given below.
   *****************************

from Tkinter import *
root = Tk()
c = Canvas(root,width="300m",height="300m",background
= 'gray')
c.pack()

def mouseMove(event):
	print c.canvasx(event.x), c.canvasy(event.y)

c.create_rectangle('16m','10.5m','21m','15.5m',fill='blue')
c.bind('<Motion>',mouseMove)
root.mainloop()

Tnanx


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4