Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Getting the mouse pointer position

4 views
Skip to first unread message

Jeffrey Hobbs

unread,
Nov 4, 1996, 3:00:00 AM11/4/96
to

In article <55lh1k$d...@cpca4.uea.ac.uk>,
Richard Mundell# <u942...@cpca4.uea.ac.uk> wrote:
>Unfortunately, the application only seems to track the mouse when the mouse
>is in the tcl/tk window that displays the coordinates. How can I track
>the mouse position throughout the whole screen? eMail assistance appreciated.

Try this:

pack [label .l -textvar COORDS] -fill x
bind all <Motion> { set COORDS "X: %X, Y: %Y" }

No weird while loop necessary.

--
Jeffrey Hobbs office: 541.683.7891
Nomad of the 'Net email: jho...@cs.uoregon.edu
URL: http://www.cs.uoregon.edu/~jhobbs/

Richard Mundell#

unread,
Nov 4, 1996, 3:00:00 AM11/4/96
to

I want to write an application where a toolbar will appear when the mouse
is moved to the extreme right of the screen. So far I've written the
following tcl application which tracks where the mouse is and displays the
x and y coordinates in a window.

Unfortunately, the application only seems to track the mouse when the mouse
is in the tcl/tk window that displays the coordinates. How can I track
the mouse position throughout the whole screen? eMail assistance appreciated.

#!/usr/bin/wish
set X 0
set Y 0
label .l -text "X $X, Y $Y"
pack .l
bind all <Motion> { set X %X; set Y %Y }
while {$X == $X} {
.l configure -text "X $X, Y $Y"
update
}


Thanks,


Richard Mundell
--
--- Richard Mundell
---- r.mu...@uea.ac.uk
----- http://www.sys.uea.ac.uk/~u9427082

Stephen O. Lidie

unread,
Nov 5, 1996, 3:00:00 AM11/5/96
to

Jeffrey Hobbs (jho...@cs.uoregon.edu) wrote:
: In article <55lh1k$d...@cpca4.uea.ac.uk>,
: Richard Mundell# <u942...@cpca4.uea.ac.uk> wrote:
: >Unfortunately, the application only seems to track the mouse when the mouse


: >is in the tcl/tk window that displays the coordinates. How can I track
: >the mouse position throughout the whole screen? eMail assistance appreciated.

: Try this:

: pack [label .l -textvar COORDS] -fill x
: bind all <Motion> { set COORDS "X: %X, Y: %Y" }

: No weird while loop necessary.

pointerxy()

0 new messages