mailmeakhila has asked for the wisdom of the Perl Monks concerning the following question:
#! /usr/bin/perl -w use Tk; my $mw = new MainWindow; $mw->geometry("300x300"); $mw->title("Perl Tk Checkbutton"); my $check_frame = $mw->Frame()->pack(-side=>"top"); my $label=$check_frame->Label(-text=>"Enter keywords")->pack(-side=>"t +op")->pack(); my $entry = $check_frame->Entry()->pack(); #my $chk1 = $check_frame->Checkbutton(-text=>"Alaska",-variable=>"Alas +ka")->pack(); my $state = "Alaska"; my $chk1 = $check_frame->Checkbutton(-text=>"Alaska",-command=>[\&chec +k_sub,$state])->pack(); my $chk2 = $check_frame->Checkbutton(-text=>"Michigan",-variable=>"Mic +higan")->pack(); my $button_frame = $mw->Frame()->pack(-side=>"bottom"); my $ok_button = $button_frame->Button(-text=>"Submit",-command=>\&chec +k_sub)->pack(-side=>"left"); MainLoop; sub check_sub{ print $_; my @names = $entry->get(); print @names; exit; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: perl tk Check button.
by zentara (Cardinal) on Apr 12, 2012 at 15:18 UTC | |
by mailmeakhila (Sexton) on Apr 12, 2012 at 15:42 UTC | |
by zentara (Cardinal) on Apr 12, 2012 at 17:42 UTC | |
by mailmeakhila (Sexton) on Apr 12, 2012 at 20:12 UTC |