Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Justify text Tcl::Tk

by Anonymous Monk
on Mar 09, 2016 at 21:04 UTC ( [id://1157228]=perlquestion: print w/replies, xml ) Need Help??

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

Hi Monks! I have some code and I can't figure out how to left justify. I've check the Tcl::Tk can page but I can't find anything. Here's a tear out of my code

my $frame_border_bottom = $mw->Frame( -relief => "flat" ); my $welcome_label_bottom = $frame_border_bottom->Label( -text => "Searching for Keywords/City + pairs \n" ); $frame_border_bottom->grid( -row => 7, -column => 3, -columnspan = +> 6 ); $welcome_label_bottom->grid( -row => 7, -column => 3, -columnspan +=> 6 );

Thanks in advance for the help.

Replies are listed 'Best First'.
Re: Justify text Tcl::Tk grid
by Anonymous Monk on Mar 09, 2016 at 21:34 UTC
    Use sticky option of grid to justify the label

      I did a few google searches and didn't find much other than this:

      my $welcome_label_bottom = $frame_border_bottom->Label( -text => "Progress Update: \n" )->pac +k(-side=>'right', -anchor=>'n');

      but it doesn't seem to work

      what would the sticky option of grid code look like? - thanks!</p?

        "what would the sticky option of grid code look like?"

        See the Tk::grid documentation.

        See the "Tk distribution page" for links to the documentation for all the core Tk::* modules.

        — Ken

Re: Justify text Tcl::Tk
by dbuckhal (Chaplain) on Mar 10, 2016 at 16:18 UTC
    How about thinking outside the "Tk box" and pre-format your text before you assign it to the text attribute:
    $ perl -le ' $left = sprintf( ">>%-10s<<", "left" ); $right = sprintf( ">>%10s<<", "right" ); print "$left\n"; print "$right\n"; ' __output__ >>left << >> right<<
    Hope it helps!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2024-04-24 07:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found