in reply to Content of Perl/Tk Fixed-Width Text Label is Always Centred!?

strat had the right idea but the wrong location. -anchor isn't only a pack option, it's a standard widget option. Try:

use strict; use Tk; my $mw = MainWindow->new; my $lbl = $mw->Label( # File -text => '(start)', -width => 12, -background => 'bisque', -relief => 'groove', -anchor => 'w', )->pack; my $btn = $mw->Button( -text => "Go!", -command => \&test, )->pack; MainLoop; sub test { $lbl->configure(-text => 'A'); }

Replies are listed 'Best First'.
Re^2: Content of Perl/Tk Fixed-Width Text Label is Always Centred!?
by ozboomer (Friar) on Mar 29, 2006 at 12:45 UTC
    Bingo! The -anchor on the widget works a treat. Docs on Tk::options was the clue.

    Some experimenting now seems to say you can even use it in whatever->configure() to change the "justification" on the fly.

    There's always another subtlety to discover with Perl/Tk :)

    Many thanks, once again, dear monks.