Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: perl/tk changing button commands

by kelan (Deacon)
on Apr 23, 2003 at 13:56 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others about the Monastery: (7)
As of 2024-04-18 12:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found