For Programmers: Free Programming Magazines  


Home > Archive > PerlTk > January 2005 > a great sample code!









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author a great sample code!
jiehuang001@hotmail.com

2005-01-26, 3:57 pm

Thanks so much, Marc!!!

Jie

Marc Dashevsky wrote:
> In article <1106598579.877398.246410@z14g2000cwz.googlegroups.com>,

jiehuang001
> @hotmail.com says...
from a[color=darkred]
then[color=darkred]
>
> use strict;
> use Tk;
>
> my $Frame;
> my $mw = tkinit;
> my $pane = $mw->Scrolled('Pane',
> -scrollbars => 'e',
> )->pack(-expand => 1, -fill => 'both');
> $mw->Button(
> -text => 'Refresh',
> -command => \&Refresh,
> )->pack;
> Refresh();
> MainLoop;
>
> sub Refresh {
> my @a;
> for (my $i = 0; $i < 10; $i++) {push(@a, int(rand(100)))}
> DisplayCheckButtons($pane, @a)
> }
>
> sub DisplayCheckButtons {
> my($parent, @names) = @_;
> $Frame->destroy if $Frame;
> $Frame = $parent->Frame->pack(-expand => 1, -fill => 'both');
> map {$Frame->Checkbutton(-text => $_)->pack} @names;
> }
>
> --
> Go to http://MarcDashevsky.com to send me e-mail.


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com