in reply to Tk:Text resize dillema
#!/usr/bin/perl use warnings; use strict; use Tk; use Tk::Zinc; my $mw = MainWindow->new(); $mw->geometry($mw->screenwidth . 'x' . $mw->screenheight . '+0+20'); $mw->title("Text Scale Test"); my $zinc = $mw->Zinc( -height => $mw->screenheight, -width => $mw->screenwidth, -backcolor => 'black', -relief => 'raised' )->pack(); $zinc->fontCreate( "fonta", -family => 'arial', -size => -30, -weight => 'bold' ); my $text = $zinc->add('text',1, -position => [$mw->screenwidth/2 , 75 ], -text => 'foobar foobaz', -composescale => 1, -anchor => 'center', -color => 'hotpink', -font => 'fonta', ); $mw->bind( '<ButtonPress-1>', sub { &move } ); $mw->bind( '<ButtonPress-3>', sub { &move1; } ); #my $id = $mw->repeat(75, sub{ &move } ); MainLoop; sub move { # $zinc->translate($text,0, 1); $zinc->scale( $text, 1.1, 1.1); } sub move1 { # $zinc->translate($text,0, 1); $zinc->scale( $text, .9, .9); } __END__
|
|---|