examples/destroy_test
raw| 1 | #!/usr/local/bin/perl -w |
| 2 | |
| 3 | |
| 4 | use Tk; |
| 5 | |
| 6 | require Tk::Pretty ; |
| 7 | |
| 8 | $top = MainWindow->new(); |
| 9 | |
| 10 | $label = $top->Label("-text" => "Something" ); |
| 11 | |
| 12 | $label->bind('<Destroy>' , sub { printf "RIP %s\n", shift->PathName }); |
| 13 | $top->bind('<Destroy>' , sub { printf "top RIP %s\n", shift->PathName }); |
| 14 | |
| 15 | $label->pack; |
| 16 | |
| 17 | $quit = $top->Button("-text" => "Quit", "-command" => ["destroy",$top]); |
| 18 | |
| 19 | $quit->pack; |
| 20 | |
| 21 | $top->update(); |
| 22 | |
| 23 | Tk::MainLoop(); |
| 24 |