Ticket #623: mocinno.pl
| File mocinno.pl, 448 bytes (added by Quevlar, 4 years ago) |
|---|
| Line | |
|---|---|
| 1 | #!/usr/bin/perl -w |
| 2 | use Tk; |
| 3 | use strict; |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | my $mw = MainWindow->new; |
| 9 | |
| 10 | |
| 11 | my $frame2 = $mw->Frame(-label => "Frame",-borderwidth => 2, -relief => 'groove'); |
| 12 | $frame2->Button(-text => 'Run',-width => 15, -command => sub { hello(); })->pack; |
| 13 | $frame2->pack(-ipadx => 20,-ipady => 20); |
| 14 | |
| 15 | #This loop makes that sub hello becomes like an event |
| 16 | MainLoop; |
| 17 | |
| 18 | |
| 19 | |
| 20 | #Event of button |
| 21 | sub hello { |
| 22 | system('echo "hello world"'); |
| 23 | |
| 24 | exit; #Quit from aplication |
| 25 | |
| 26 | } |
| 27 | |
| 28 |
