Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

How do I space out each radio button horizontally in Perl/Tk

by Janish (Sexton)
on Jul 11, 2014 at 03:43 UTC ( #1093172=perlquestion: print w/replies, xml ) Need Help??

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

Hi, anybody can help on this?

As title says, how can I add horizontal spacing between a radio button and it's text? The text is way too close to the radio button make the gui looks weird. Below is my code (I tried columnspan and it seems doesn't works for me):

$mw->Label(-text => 'Package Selection', -justify => 'left' )->grid(-sticky => 'w', -column => 0, -row => 1); my $package = 'normal'; foreach my $type (qw(normal pckg_A pckg_B)){ $mw->Radiobutton( -text => $type, -value => $type, -variable => \$package, #)->grid(-sticky => 'w', -column => 1, -row => 2); )->grid(-sticky => 'w', -column => 1, -row => 2, -columnspan=>20, +-padx => 50, ); }

Thank you.

Replies are listed 'Best First'.
Re: How do I space out each radio button horizontally in Perl/Tk
by rovf (Priest) on Jul 11, 2014 at 05:49 UTC
    The text is way too close to the radio button

    Maybe not the most elegant solution, but wouldn't it be easiest to simply pad the text with a couple of spaces?

    -- 
    Ronald Fischer <ynnor@mm.st>

      Thanks for your reply. What do you means by pad the test with spaces? Sample code would be very much helpful to me

        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;
      A reply falls below the community's threshold of quality. You may see it by logging in.
      Not really, because when the padding-with-spaces hits the browser, the browser will ignore multiple white-space characters after the first (or is it the last?) In any case, to pad with spaces anything that's going to a browser, you'll have to use &nbsp;, or CSS styling.

      check Ln42!

        you'll have to use  , or CSS styling
        But we are not talking HTML here. It's Tk!

        -- 
        Ronald Fischer <ynnor@mm.st>
Re: How do I space out each radio button horizontally in Perl/Tk
by Anonymous Monk on Jul 11, 2014 at 07:05 UTC

    almost all the widgets are paddable

    Use  use Tk::WidgetDump; $mw>WidgetDump; $mw->MainLoop(); and examine the labels in widgetdump, change the padding, see if you like the results

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2021-09-17 17:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?