![]() |
Tk::Checkbutton - text does not line up ...
HI,
Using a function on Windows,I define a $test variable as following: $text=sprintf("%-35s %-13s",$_,'(directory)'); Then define the checkbutton: $button[$i] = $dialog5->Checkbutton(-text => "$text",-variable => \($var->{$_}),-relief => 'flat')->pack(@pl); The text in $text DOES NOT get lined up ! If at the same time I print $text to the black window print "$text\n"; the text DOES look lined up. What is wrong ? Thanks |
Re: Tk::Checkbutton - text does not line up ...
"MoshiachNow" <lev.weissman@creo.com> wrote in message news:1157876721.088230.130660@m79g2000cwm.googlegr oups.com... > HI, > > Using a function on Windows,I define a $test variable as following: > > $text=sprintf("%-35s %-13s",$_,'(directory)'); > > Then define the checkbutton: > > $button[$i] = $dialog5->Checkbutton(-text => "$text",-variable => > \($var->{$_}),-relief => 'flat')->pack(@pl); > > The text in $text DOES NOT get lined up ! > > If at the same time I print $text to the black window > > print "$text\n"; > > the text DOES look lined up. > > What is wrong ? > Thanks > By default the text is 'center' anchored; you probably don't want this so try setting the -anchor option, e.g. anchor => 'w', as appropriate. |
Re: Tk::Checkbutton - text does not line up ...
Dave wrote:
> "MoshiachNow" <lev.weissman@creo.com> wrote in message > news:1157876721.088230.130660@m79g2000cwm.googlegr oups.com... > >>HI, >> >>Using a function on Windows,I define a $test variable as following: >> >>$text=sprintf("%-35s %-13s",$_,'(directory)'); >> >>Then define the checkbutton: >>The text in $text DOES NOT get lined up ! > > > By default the text is 'center' anchored; you probably don't want this so > try setting the -anchor option, e.g. anchor => 'w', as appropriate. > > > In addition you might consider using a fixed-width font to have the second part of your label aligned vertically as well: use strict; use warnings; use Tk; my $mw = tkinit(); my @text = map {sprintf("%-35s %-13s",$_,'(directory)') } qw(test something_else); my @buttons = map {$mw->Checkbutton(-text => $text[$_], -font=>[courier => 9] )->pack(-anchor=>'w') } (0,1); MainLoop(); Christoph -- perl -e "print scalar reverse q/ed.enilno@ergn.l.hc/" |
Re: Tk::Checkbutton - text does not line up ...
> In addition you might consider using a fixed-width font to have the second part > of your label aligned vertically as well: Thanks ! This worked like magic !! |
| All times are GMT. The time now is 10:46 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.