http://www.perlmonks.org?node_id=1031187

virudinesh has asked for the wisdom of the Perl Monks concerning the following question:

my $mw = new MainWindow(-background=>'Gray'); $mw->geometry("1400x800"); $wb[0] = $mw->Radiobutton( -variable => \$f, -command => \&toclink, -text => 'TOC LINK', -font => "r18", -width => 17, -foreground => 'black', -value => 1)->pack(-side=> 'top',-anchor=>'w',)->place(-relx => +0.0,-rely =>0.20); $wb[1] = $mw->Radiobutton( -variable => \$chap_c, -command => \&chapterlink, -text => 'CHAPTER LINK', -font => "r18", -width => 17, -foreground => 'black', -value => 1)->pack(-side=> 'top',-anchor=>'w',)->place(-relx => +0.015,-rely =>0.25); $wb[2] = $mw->Radiobutton( -variable => \$file, -command => sub {$flag =3;}, -text => 'FIGURE LINK', -font => "r18", -width => 17, -foreground => 'black', -value => 'FIGURE LINK')->pack( -side => 'top', -anchor => 'w',)->place(-relx =>0.007, -rely =>0.30); } sub toclink() { $chk2 = $frm_name->Checkbutton(-text => 'Prelims ', -variable => \$a2, -highlightcolor =>'yellow', -borderwidth =>5, -font => 'Verdana 10 bold', -onvalue => '1', -command => \&no1, #-foreground =>'red', -offvalue => '0', -background => 'DarkGray', -state =>'disable')->pack()->plac +e(-relx =>0.07, -rely =>0.15); $chk3= $frm_name->Checkbutton(-text => 'Part ', -variable => \$a3, -highlightcolor =>'yellow', -borderwidth =>5, -font => 'Verdana 10 bold', -command => \&no2, #-foreground =>'red', -onvalue => '1', -background => 'DarkGray', -offvalue => '0', -state =>'disable')->pack()->plac +e(-relx =>0.28, -rely =>0.15); $chk4= $frm_name->Checkbutton(-text => 'Chapter ', -variable => \$a4, -highlightcolor =>'yellow', -background => 'DarkGray', -borderwidth =>5, -font => 'Verdana 10 bold', -command =>\&no3, #-foreground =>'red', -onvalue => '1', -offvalue => '0', -state =>'disable')->pack()->plac +e(-relx =>0.45, -rely =>0.15); } sub chapterlink() { $frme_window = $mw -> Frame(-background => 'DarkGray',-relief => 'sunk +en')->pack(-ipadx => 330,-ipady =>0, -side => "right", -fill => "y"); $butn =$frme_window->Label(-text =>'CHAPTER LINK ',-font => 'Verdana +15 bold',-foreground => 'dark red', -background => 'DarkGray',-heigh +t => 1,-width =>23) -> pack( )->place( -relx =>0.3, -rely =>0.1); $labl = $frme_window->Label(-text =>"Chapter Files ",-font => 'Verdana + 10 bold',-foreground => 'dark red',-background => 'DarkGray',-heigh +t => 1,-width =>15) -> pack( )->place( -relx =>0.01, -rely =>0.30); $path_text6 = $frme_window->Entry(-textvariable => \$def_path1,-font = +> 'Verdana 8 bold',-width => 35,-background =>'white')->pack(-expand +=> 1)->place(-relx => 0.20, -rely => 0.3); $path_butn1 = $frme_window->Button(-foreground => 'dark red',-text = +> "Browse",-font => 'Verdana 8 bold', -height => 1,-width => 10,-comm +and => \&browsecl) -> pack ( )->place( -relx =>0.65, -rely =>0.3); } hai it was selected both keys.. Output need is is selct 1 st button only visble that function only...i +ts process will do randomly... ?

Replies are listed 'Best First'.
Re: how select single button only?
by Anonymous Monk on Apr 29, 2013 at 09:11 UTC

    :)

    $ perl fudge Unmatched right curly bracket at fudge line 21, at end of line syntax error at fudge line 21, near "}" Unmatched right curly bracket at fudge line 114, at end of line syntax error at fudge line 114, near "}" syntax error at fudge line 131, near "}" Execution of fudge aborted due to compilation errors.

    I can't reason about GUIs without seeing them, and I can't see it if the code doesn't compile

    So first thing I'd do is post code, which compiles, and shows your problem

Re: how select single button only?
by hdb (Monsignor) on Apr 29, 2013 at 09:49 UTC

    Radio buttons have to be linked to the same variable to form a group!