Ron Provost wrote:

> Is there any way in tkinter to convert between coordinate systems?  
> Specifically, I'm refering to the canvas.  I'm getting x and y's back in 
> mouse events and I would like to convert them back to inches 'i', 
> centemeters 'c', millimeters 'm' or points 'p'.

use winfo_screenheight() and winfo_screenmmheight() to determine the 
pixel size, and use that to calculate "real-life" values.  e.g.

        pixel_size = w.winfo_screenmmheight() / w.winfo_screenheight()

        ...

        x = x * pixel_size
        print x, "mm"
        print x/10.0, "cm"
        print x/25.4, "inches"
        print 72*x/25.4, "points"

(untested)

</F>

_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to