How to get the mouse cursor position in TK?

Greg Ewing see_reply_address at something.invalid
Mon Oct 7 19:05:47 EDT 2002


Martin Franklin wrote:

>> I want to pop-up an whole
>> new WINDOW, but the Tk() Objects dont know the gm place. So how can I place
>> tk Objects, and NOT widgets inside a parent?


You can position a Toplevel widget on the screen using
the wm_geometry method, e.g.

Python 2.2 (#1, Jul 11 2002, 14:19:37)
[GCC 3.0.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> import Tkinter
 >>> tk = Tkinter.Tk()
 >>> tk.wm_geometry("+10+20")

positions the main window 10 pixels from the left of
the screen and 20 from the top.


The general form of the string passed to wm_geometry
is:

    <width>x<height>+<x>+<y>

-- 
Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg




More information about the Python-list mailing list