Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

And here it is, busywork

#!/usr/bin/perl -- use strict; use warnings; use Tk; use Tk::AbstractCanvas; { my $mwin = my $mw = tkinit; my $acnv = $mwin->AbstractCanvas()->pack(-expand => 1, -fill => 'b +oth'); $acnv->controlNav(1); # advanced CtrlKey+MouseDrag Navigation $acnv->rectToPoly(1); $acnv->ovalToPoly(1); my $rect = $acnv->createRectangle( 7, 8, 24, 23, -fill => 'r +ed'); my $oval = $acnv->createOval( 23, 24, 32, 27, -fill => 'gre +en'); my $line = $acnv->createLine( 0, 1, 31, 32, -fill => 'bl +ue', -arrow => 'la +st'); my $labl = $mwin->Label(-text => 'Hello AbstractCanvas! =)'); my $wind = $acnv->createWindow(15, 16, -window => $labl); $acnv->CanvasBind('<x>' => \&exit); $acnv->CanvasFocus(); $acnv->viewAll(); my $c2 = $mwin->Canvas( -background => 'black', #~ -width => 100, #~ -height => 100, #~ -width => 20, #~ -height => 20, -width => 30, -height => 30, ); $c2->createOval(0, 0, 5, 5, -fill => 'white',-tags => ['shabba'] ) +; $mw->bind( $c2, '<ButtonPress-1>' => [ \&shabba , $acnv ]); $c2->place( qw/ -x 10 -y 10 / ); } MainLoop; sub shabba { my( $c2, $acnv ) = @_; #~ my $c2 = $Tk::event->W; my $x = $Tk::event->x; my $y = $Tk::event->y; #~ use Data::Dump; #~ dd [ $c2->configure ], [ $c2->itemconfigure( 'shabba' )] ; $c2->coords( 'shabba', $x, $y , $x+5, $y+5); # size is 5 my $width = $c2->cget('-width'); my $height = $c2->cget('-height'); my $xview = $x / $width; my $yview = $y / $height; $acnv->xviewMoveto( $xview ); $acnv->yviewMoveto( $yview ); }

See also Tk::Zinc / http://web.archive.org/web/20061020033841/http://www.tkzinc.org/


In reply to Re^2: How to control a Tk::AbstractCanvas with a second one by Anonymous Monk
in thread How to control a Tk::AbstractCanvas with a second one by KuntalBhusan

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others making s'mores by the fire in the courtyard of the Monastery: (9)
    As of 2014-10-20 23:07 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      For retirement, I am banking on:










      Results (92 votes), past polls