A Scrolled object is not the real thing, it's the parent of the real thing. Mostly, things work properly, but not always.

Get the real canvas and apply ->scale to that:

#!/usr/bin/perl # http://perlmonks.org/?node_id=1146938 use strict; use warnings; use Tk; sub GUI() { my $fenetre = new MainWindow( -title => 'test', ); $fenetre->minsize( 200, 70 ); my $cadre_voie = $fenetre->Frame()->pack(-fill => 'both', -expand +=> 1); my $voie = $cadre_voie->Scrolled( 'Canvas', -background => '#A0A0A0', ); $voie->pack(-fill => 'both', -expand => 1); my $realcanvas = $voie->{SubWidget}{canvas}; $cadre_voie->Scale(-orient=>'horizontal')-> pack(); #$fenetre->repeat( 500, sub { $voie->scale('all',0,0,1,1); } ); $fenetre->repeat( 500, sub { $realcanvas->scale('all',0,0,1,1); } +); MainLoop; # Obligatoire } GUI();

In reply to Re: Tk::Error: bad window path name "all" by Anonymous Monk
in thread Tk::Error: bad window path name "all" by topwl

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.