ozboomer has asked for the wisdom of the Perl Monks concerning the following question:
When -width is specified, why is the text label contents always centred? -justify is documented to only work with multi-line content (and I've tried it anyway and the content is still always centred). Experiments with pack, place, etc don't seem to shed any light on it.
How can the contents of a fixed-width text label be left-justified? The attached code shows that as soon as the widget is created, it's already centring the text, even before the button action changes the text content.
As usual, I'm trying this with ActiveState Perl, Build 813 under WinXP.use strict; use Tk; my $mw = MainWindow->new; my $lbl = $mw->Label( # File -text => '(start)', # -width => 12, -background => 'bisque', # -justify => 'left', -relief => 'groove', )->pack; my $btn = $mw->Button( -text => "Go!", -command => \&test, )->pack; MainLoop; sub test { $lbl->configure(-text => 'A'); }
Any suggestions on where to look next?
Thanks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Content of Perl/Tk Fixed-Width Text Label is Always Centred!?
by strat (Canon) on Mar 29, 2006 at 07:36 UTC | |
by herveus (Prior) on Mar 29, 2006 at 12:04 UTC | |
by ozboomer (Friar) on Mar 29, 2006 at 09:34 UTC | |
|
Re: Content of Perl/Tk Fixed-Width Text Label is Always Centred!?
by thundergnat (Deacon) on Mar 29, 2006 at 11:59 UTC | |
by ozboomer (Friar) on Mar 29, 2006 at 12:45 UTC | |
|
Re: Content of Perl/Tk Fixed-Width Text Label is Always Centred!?
by zentara (Cardinal) on Mar 29, 2006 at 12:09 UTC |