Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Strange behavior of iteration while creating Perl/Tk widgets dynamically

by BillKSmith (Monsignor)
on Nov 02, 2021 at 15:23 UTC ( [id://11138336]=note: print w/replies, xml ) Need Help??


in reply to Strange behavior of iteration while creating Perl/Tk widgets dynamically

My previous reply provides a solution to your 'overflowing' problem. The difference is in the scope of $i. I admit that the documentation does not make this clear although it does address it.
#for (my $i = 1; $i <= 5; $i++) { for my $i (1..5) {

However, your script still does not execute correctly. (Error when pressing any of the CLR buttons.) Symbolic references are almost always a poor design choice. They are error prone and very hard to debug. (Largely because you have given up the benefit of use strict but also because of their strange syntax.) Your error message points to the offending line. After correcting two symbolic error bugs in that line, your program runs without error. I have no idea if it does what you intend.

#$$clrCanvas -> itemconfigure(${$clrCanvasItem}, -fill => $color); $clrCanvas -> itemconfigure($clrCanvasItem, -fill => $color);
Bill

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11138336]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-03-29 14:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found