f



aligning widgets in perl

hi, can you please help i am trying to align my widgets all to the left but it is not working. there are in a frame.

  $labelName =$Frame->Frame->pack( -side => 'top', -pady => 15, -anchor => 'nw' );
     $labelName ->Label(
     -text => 'Name',
     -font => '-*-Verdana-Bold-R-Normal-*-*-90-*-*-*-*-*-*'
    )->grid($labelName ->Entry( -textvariable => \$new_imp_legend )->pack( -padx => 15 ));
  $labelName2 =$Frame->Frame->pack( -side => 'top', -pady => 15, -anchor => 'nw' );
     $labelName2 ->Label(
     -text => 'Surname',
     -font => '-*-Verdana-Bold-R-Normal-*-*-90-*-*-*-*-*-*'
    )->grid($labelName2 ->Entry( -textvariable => \$new_imp_legend )->pack( -padx => 15 ));

 $CheckButton= $Frame->Frame->pack( -pady => 10, -anchor => 'nw' );
 $CheckButton->Label(
     -text => 'Are you happy?',
     -font => '-*-Verdana-Bold-R-Normal-*-*-90-*-*-*-*-*-*',
     )->grid($CheckButton->Checkbutton(
                -variable => \$is_cosmetic,
                -onvalue  => "Y",
                -offvalue => "N",
                -state    => $nstate )->pack() );

please help.

        
0
molomogale
2/18/2014 9:28:41 AM
comp.lang.perl.tk 4721 articles. 0 followers. pharrendorf (19) is leader. Post Follow

1 Replies
629 Views

Similar Articles

[PageSpeed] 21

molomogale@gmail.com schrieb am 18.02.2014 10:28:
> hi, can you please help i am trying to align my widgets all to the left but it is not working. there are in a frame.
> [...]

Try it this way and look how nice they *all* are aligned to the left
(but also look at the contructors, how $Frame is used as the parent widget):

#!/usr/bin/env perl
use warnings;
use strict;
use Tk;

my $new_imp_legend = 'imp';
my $is_cosmetic    = 'Y';
my $nstate         = 'normal';

my $mw = MainWindow->new();
my $Frame =
   $mw->Frame()->pack( -side => 'top', -anchor => 'nw', -fill => 'both' );

my $labelName = $Frame->Label(
   -text => 'Name',
   -font => '-*-Verdana-Bold-R-Normal-*-*-90-*-*-*-*-*-*'
)->pack( -side => 'top', -anchor => 'nw' );
my $entryName = $Frame->Entry( -textvariable => \$new_imp_legend )
   ->pack( -side => 'top', -anchor => 'nw' );

my $labelName2 = $Frame->Label(
   -text => 'Surname',
   -font => '-*-Verdana-Bold-R-Normal-*-*-90-*-*-*-*-*-*'
)->pack( -side => 'top', -anchor => 'nw' );
my $entryName2 = $Frame->Entry( -textvariable => \$new_imp_legend )
   ->pack( -side => 'top', -anchor => 'nw' );

my $labelCB = $Frame->Label(
   -text => 'Are you happy?',
   -font => '-*-Verdana-Bold-R-Normal-*-*-90-*-*-*-*-*-*',
)->pack( -side => 'top', -anchor => 'nw' );
my $CheckButton = $Frame->Checkbutton(
   -variable => \$is_cosmetic,
   -onvalue  => "Y",
   -offvalue => "N",
   -state    => $nstate
)->pack( -side => 'top', -anchor => 'nw' );

MainLoop;


HTH, Horst

-- 
<remove S P A M 2x from my email address to get the real one>
0
Horst
2/18/2014 10:33:21 AM
Reply: