Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
When I run your review2.pm, I get your error. But I added a line which shows the problem. I can't figure out why it allowed you to create an Oval to begin with.?
sub paint_Info{ #this shows the problem my ($MW, $CW, $zoom) = @_; print "\n\n@_\n\n"; $CW->createOval( 30, 30, 15, 15, -outline => 'red', -width => 2, -tags => ['INFO']); my $zfactor = ($zoom > 0) ? $zoom : -1 / $zoom; $CW->scale('all', 0, 0, $zfactor, $zfactor); }
When you print out @_, you get
MainWindow=HASH(0x7b8078) Tk::Frame=HASH(0xe2bfb0) 1
You then take $_1 and try to run Canvas methods on it. Scale will not run on a Frame, that is a Canvas method.

It just dawned on me! Your Frame is the Scrolled Frame the Canvas is in. Try getting the real canvas in your module. This fixes it! :-)

sub paint_Info # ($MW, $Config) { my ($MW, $CW, $zoom) = @_; print "\n\n@_\n\n"; my $canvas = $CW->Subwidget('canvas'); $canvas->createOval( 30, 30, 15, 15, -outline => 'red', -width => 2, -tags => ['INFO']); my $zfactor = ($zoom > 0) ? $zoom : -1 / $zoom; $canvas->scale('all', 0, 0, $zfactor, $zfactor); }

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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2024-04-24 15:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found