Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^3: How do I space out each radio button horizontally in Perl/Tk

by stefbv (Curate)
on Jul 11, 2014 at 06:29 UTC ( #1093185=note: print w/replies, xml ) Need Help??


in reply to Re^2: How do I space out each radio button horizontally in Perl/Tk
in thread How do I space out each radio button horizontally in Perl/Tk

Probably this is what rovf sugested, also note that I use Tk::RadiobuttonGroup.

use strict; use warnings; use Tk; use Tk::widgets qw(RadiobuttonGroup); my $mw = MainWindow->new; $mw->Label( -text => 'Package Selection', -justify => 'left' )->pack; my $package = 'normal'; my $radiobuttongroup = $mw->RadiobuttonGroup ( -list => [' normal', ' pckg_A', ' pckg_B'], -orientation => 'vertical', -variable => \$package, -command => sub { print $package, "\n"; } )->pack; MainLoop;
  • Comment on Re^3: How do I space out each radio button horizontally in Perl/Tk
  • Download Code

Replies are listed 'Best First'.
Re^4: How do I space out each radio button horizontally in Perl/Tk
by Janish (Sexton) on Jul 11, 2014 at 06:39 UTC
    Thank you but my system restrict me to use radiobuttongroup.

      That's not a problem:

      use strict; use warnings; use Tk; my $mw = MainWindow->new; my $package = 'normal'; foreach my $type (qw(normal pckg_A pckg_B)) { $mw->Radiobutton( -text => " $type", -value => $type, -variable => \$package, )->pack; } MainLoop;

        Thanks stefbv. However, I'm using notebook and I have it packed earlier on my code, guess I can only use grid to set the position right?

        I have something like this is my early code

        my $tab = $notebook->add('page1', -label=> 'Package'); my $mwt_pckg = $tab1->Frame()->pack ;

        Then folowing by this

        my $package = 'normal'; foreach my $type (qw(normal pckg_A pckg_B)) { $mwt_pckg->Radiobutton( -text => " $type", #modified here as you suggested. -value => $type, -variable => \$package, #)->grid(-sticky => 'w', -column => 1, -row => 2); )->grid(-sticky => 'w', -column => 1, -row => 2, -columnspan=>20, +-padx => 50, );

        However, it just doesn't works as I wish.

        Note, if I modify the code replacing the current grid position with pack, the gui doen't pop up at all.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1093185]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (1)
As of 2021-07-28 01:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?