Check Tk::callbacks and http://perltk.org.

Here are a few examples:

print '<ul>'; print qq,<li>\[id://$_]\n, for qw, 112357 134380 135639 179956 176475 ,; print '</ul>'; __END__

update: here's your example modified

use strict; use warnings; use diagnostics; use Tk; my $mw= MainWindow->new; my $canvas= $mw->Canvas( -background => 'black', -width => '100', -height => '200', )->pack; # either will work, I like the last one #$canvas->CanvasBind('<Motion>', [\&scrappy, Ev('X'), Ev('Y'), Ev('s') +]); #$mw->bind('all','<Motion>', [\&scrappy, Ev('X'), Ev('Y'), Ev('s')]); $mw->bind('Tk::Canvas','<Motion>', [\&scrappy, Ev('X'), Ev('Y'), Ev('s +')]); &MainLoop(); sub scrappy { my ( $widget, $x, $y, $s ) = @_; printf qq[widget: %s x: %04.4s, y: %04.4s modifier: %s \n], @_; } __END__ widget: Tk::Canvas=HASH(0x232b3d4) x: 0348, y: 0319 modifier: Mod1- widget: Tk::Canvas=HASH(0x232b3d4) x: 0347, y: 0320 modifier: Mod1- widget: Tk::Canvas=HASH(0x232b3d4) x: 0346, y: 0320 modifier: Mod1- widget: Tk::Canvas=HASH(0x232b3d4) x: 0345, y: 0320 modifier: Mod1- widget: Tk::Canvas=HASH(0x232b3d4) x: 0343, y: 0320 modifier: Mod1- widget: Tk::Canvas=HASH(0x232b3d4) x: 0341, y: 0320 modifier: Mod1- widget: Tk::Canvas=HASH(0x232b3d4) x: 0339, y: 0320 modifier: Mod1- widget: Tk::Canvas=HASH(0x232b3d4) x: 0338, y: 0320 modifier: Mod1- widget: Tk::Canvas=HASH(0x232b3d4) x: 0337, y: 0320 modifier: Contro +l-Mod1- widget: Tk::Canvas=HASH(0x232b3d4) x: 0336, y: 0320 modifier: Contro +l-Mod1- widget: Tk::Canvas=HASH(0x232b3d4) x: 0334, y: 0320 modifier: Contro +l-Mod1- widget: Tk::Canvas=HASH(0x232b3d4) x: 0333, y: 0320 modifier: Contro +l-Mod1- widget: Tk::Canvas=HASH(0x232b3d4) x: 0333, y: 0321 modifier: Contro +l-Mod1- widget: Tk::Canvas=HASH(0x232b3d4) x: 0332, y: 0321 modifier: Contro +l-Mod1- widget: Tk::Canvas=HASH(0x232b3d4) x: 0330, y: 0321 modifier: Shift- +Mod1- widget: Tk::Canvas=HASH(0x232b3d4) x: 0329, y: 0321 modifier: Shift- +Mod1- widget: Tk::Canvas=HASH(0x232b3d4) x: 0328, y: 0321 modifier: Shift- +Mod1- widget: Tk::Canvas=HASH(0x232b3d4) x: 0327, y: 0322 modifier: Shift- +Mod1- widget: Tk::Canvas=HASH(0x232b3d4) x: 0326, y: 0322 modifier: Shift- +Mod1- widget: Tk::Canvas=HASH(0x232b3d4) x: 0325, y: 0322 modifier: Shift- +Mod1- widget: Tk::Canvas=HASH(0x232b3d4) x: 0324, y: 0322 modifier: Shift- +Mod1-

____________________________________________________
** The Third rule of perl club is a statement of fact: pod is sexy.


In reply to Re: Tk event examples? by PodMaster
in thread Tk event examples? by toma

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.