in reply to Mimicking UNIX Eyes
....this almost smells of homework..... so here is some starter code .....for it to work on Tk, it needs window focus .... and you will see the problem as you move the window around...... you could make a full-screen Tk app and use this code to drive balls on a canvas widget.... that would be easy..... but it's your homework ;-)
...if you want a christmas toy, try Newtons-Cradle-Tk-Zinc#!/usr/bin/perl use warnings; use strict; use Tk; my $mw= tkinit; $mw->bind('<Motion>' => [\&show_position,$mw]); MainLoop; sub show_position{ my $widget = shift; my $x = $widget->pointerx; my $y = $widget->pointery; print "$x $y\n"; # ($x, $y) = $widget->pointerxy; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Mimicking UNIX Eyes
by Anonymous Monk on Dec 17, 2009 at 14:37 UTC |