I'll try out your code (assuming it's tested)

Yes, it's well tested standard code. If you want to zoom text, you can configure the font object to use a scaled up point size. Rebuilding the font, just as you rebuild a new image.

#!/usr/bin/perl use warnings; use strict; use Tk; require Tk::Font; #by originally by Chris Lamprecht my $MAIN = new MainWindow; my $canvas = $MAIN->Canvas()->pack(-expand => 'yes', -fill =>'both'); my $initial_fontsize = 24; my $scaling_factor = 1; my $l_text = "current scaling_factor : $scaling_factor"; my $helveticaStd = $MAIN->Font(-family=> 'Arial', -size => $initial_ +fontsize); my $text = 'This is some text'; $canvas->createText(50,50, -text => $text, -anchor => 'nw', -font => $helveticaStd); $canvas->createRectangle(47,47,290,87); for my$fac (0.8,1.2){ $MAIN->Button(-text => "Scale by $fac", -command => [\&scaling,$fac] )->pack; } $MAIN->Label(-textvariable=>\$l_text)->pack; MainLoop; sub scaling{ $scaling_factor *= $_[0]; $canvas->scale('all',0,0,$_[0],$_[0]); $helveticaStd->configure(-size=>$initial_fontsize * $scaling_factor +); $l_text = "current scaling_factor : $scaling_factor"; } __END__

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

In reply to Re^3: Tk: Scaling canvas objects by zentara
in thread Tk: Scaling canvas objects by perldough

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.