Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: perl/tk changing button commands

by kelan (Deacon)
on Apr 23, 2003 at 13:56 UTC ( #252541=note: print w/replies, xml ) Need Help??


in reply to perl/tk changing button commands

How about just having an array that holds whatever pieces of text you want and looping through it. (Untested)

#!/usr/bin/perl use strict; use warnings; use Tk; my $main = MainWindow->new; my $label1 = $main->Text( -width => 50 )->pack; my $count = 0; my @texts = ( "This is the first piece.\n", "This is the second.\n", "This is the third.\n", "etc...\n", ); my $button = $main->Button( -text => "Next", -command => sub { $label1->insert('1.0', $texts[$count++]); } )->pack; MainLoop;

kelan


Perl6 Grammar Student

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2022-11-26 22:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?