I don't know what you mean by trigger.
#!/usr/bin/perl # http://perlmonks.org/?node_id=1170638 use strict; use warnings; use Tk; use Tk::JPEG; use Image::Size; my $file = '../smalltux.gif'; my ($w, $h) = imgsize($file); my $mw = new MainWindow; my $one = $mw->Frame()->pack; my $labelone = $one->Label(-text => 'Panel One', -fg => 'red', )->pack(-side => 'left'); $one->Button(-text => 'On', -command => sub { $labelone->configure(-fg => 'green')}, )->pack(-side => 'left'); $one->Button(-text => 'Off', -command => sub { $labelone->configure(-fg => 'red')}, )->pack(-side => 'left'); my $c = $mw->Canvas(-width => $w, -height => $h )->pack(); my $im = $c->Photo(-file =>$file); $c->createImage(0, 0, -image => $im, -anchor => 'nw'); my $two = $mw->Frame()->pack; my $labeltwo = $two->Label(-text => 'Panel One', -fg => 'red', )->pack(-side => 'left'); $two->Button(-text => 'On', -command => sub { $labeltwo->configure(-fg => 'green')}, )->pack(-side => 'left'); $two->Button(-text => 'Off', -command => sub { $labeltwo->configure(-fg => 'red')}, )->pack(-side => 'left'); MainLoop;
In reply to Re^3: Feedback for programming a UI in Perl
by Anonymous Monk
in thread Feedback for programming a UI in Perl
by stevieb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |