examples/prop_demo
raw| 1 | #!/usr/local/bin/perl -w |
| 2 | |
| 3 | use Tk; |
| 4 | |
| 5 | sub show_props |
| 6 | {my $w = shift; |
| 7 | print "Props $w:\n"; |
| 8 | foreach ($w->property("list",@_)) |
| 9 | { |
| 10 | print " $_:",join(',',$w->property("get",$_,@_)),"\n"; |
| 11 | } |
| 12 | } |
| 13 | |
| 14 | $top = MainWindow->new(); |
| 15 | $top->withdraw; |
| 16 | |
| 17 | $top->property("set",MYPROP,AREA,32,[1,2,3,4,5]); |
| 18 | |
| 19 | $top->command([$0,@ARGV]); |
| 20 | |
| 21 | print "Command:",join(' ',@{$top->command}),"\n"; |
| 22 | |
| 23 | $top->idletasks; |
| 24 | |
| 25 | &show_props($top); |
| 26 | |
| 27 |