in reply to Tk/Perl Command
#!/usr/bin/perl use Tk; use strict; use constant BUTTON_WIDTH => 20; my $mw = new MainWindow(title => "demo"); my $button = $mw->Button(text => "color", width => BUTTON_WIDTH) ->pack; $mw->Button(text => "red", width => BUTTON_WIDTH, command => sub {change_color($button, "red")}) ->pack; $mw->Button(text => "green", width => BUTTON_WIDTH, command => sub {change_color($button, "green")}) ->pack; MainLoop; sub change_color { my ($widget, $color) = @_; $widget->configure(background => $color); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Tk/Perl Command
by aquarium (Curate) on Mar 21, 2003 at 02:12 UTC | |
|
There We Go!
by £okì (Scribe) on Mar 20, 2003 at 18:49 UTC |