Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Widget array possible? 1

Status
Not open for further replies.

AMiSM

Technical User
Jan 26, 2006
128
0
0
US

Hi, folks!
Is it possible in Tk to reference widgets through an array?
e.g. - $mywidg[1] = [button1]
$mywidg[2] = [button2]
$mywidg[3] = [button3]
$mywidg[4] = [button4]
etc...
 
Yes it is.

Code:
push (@widgets, $mw->Button (...));

It's even convenient for if you ever wanna clear your window of widgets. ;)

Code:
foreach (@widgets) {
   $_->destroy;
}

-------------
Cuvou.com | My personal homepage
Project Fearless | My web blog
 
Cool!

How do you use pack or grid with this?
 
Never mind, I figured out what I was doing wrong.

Thanks, Kirsle! I appreciate what you do on this site! You've put in alot of work here!
 
Howdy!
How would you attach graphics to buttons in an array, each graphic different?
 
Never mind. Figured it out.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top