Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hoi, I just started with the Tk module and i am trying to get some text from an Entry widget to display on a label but it keeps being centered while i want it left aligned. I have been looking at internet sources but i can't bring it to work. Please help. Here is the code
use strict; use warnings; use Tk; my $mw = MainWindow->new; my $entry = $mw->Entry(); my $label = $mw->Label(-justify=>'left'); my $but1 = $mw->Button(-text=>"go",-command=>\&go); $but1->place(-x=>10,-y=>10,-width=>50,-height=>20); $entry->place(-x=>10,-y=>40,-width=>50,-height=>20); $label->place(-x=>10,-y=>70,-width=>50,-height=>20); MainLoop; sub go{ my $text = $entry->get; $label->configure(-text=>$text)};
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Tk label align left not centered
by Tux (Canon) on Jan 20, 2020 at 14:57 UTC | |
by Anonymous Monk on Jan 20, 2020 at 15:06 UTC |