ghosh123 has asked for the wisdom of the Perl Monks concerning the following question:
Hi
I have two checkbuttons (namely 'Main' and 'Top')in my perl tk application. One checkbutton is on the main gui and other is on a toplevel (popup) gui.
How can I keep both of them in sync
Following is the code:
use Tk; my $mw = MainWindow->new ; my ($m,$t); $mw->geometry("100x100"); $mw->Checkbutton(-text => 'Main',-variable=>\$m)->pack(-side => 'left' +); $mw->Button(-text => 'popup', -command => sub {my $t = $mw->Toplevel() +;$t->geometry("50x50");$t->Checkbutton(-text => 'Top',-variable => \$ +t)->pack(-side => 'left')})->pack(); MainLoop;
How can I keep 'Main' and 'Top' in sync.
That means when 'top' is selected , 'Main' also gets selected and similarly when 'Top' is deselected
that makes also 'Main' deselected.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to keep two checkbuttons in sync
by Anonymous Monk on Mar 27, 2013 at 18:19 UTC | |
|
Re: How to keep two checkbuttons in sync
by gurpreetsingh13 (Scribe) on Mar 28, 2013 at 03:29 UTC |