Layout control: fill : Layout « GUI « Perl






Layout control: fill

 

#!/usr/local/bin/perl -w
use Tk;
use strict;

our($filename, $info);

my $mw = MainWindow->new;
# Create necessary widgets
my $f = $mw->Frame->pack(-side => 'top', -fill => 'x');
$f->Label(-text => "Filename:")->pack(-side => 'left', -anchor => 'w');
$f->Entry(-textvariable => \$filename)->
    pack(-side => 'left', -anchor => 'w', -fill => 'x', -expand => 1);
$f->Button(-text => "Exit", -command => sub { exit; } )->
    pack(-side => 'right');
$f->Button(-text => "Save", -command => \&save_file)->
    pack(-side => 'right', -anchor => 'e');
$f->Button(-text => "Load", -command => \&load_file)->
    pack(-side => 'right', -anchor => 'e');
$mw->Label(-textvariable => \$info, -relief => 'ridge')->
    pack(-side => 'bottom', -fill => 'x');
my $t = $mw->Scrolled("Text")->pack(-side => 'bottom', 
         -fill => 'both', -expand => 1);

MainLoop;

sub load_file {
}

sub save_file {
}

   
  








Related examples in the same category

1.Pack controls on a window
2.Pack left, right, both
3.Using pack to control widget placement
4.Using place method to set control location
5.Control the fill
6.Layout controls: Pack to the top
7.Pack Bottom
8.Pack Left
9.Pack Right
10.Pack Top
11.Adding radio buttom to Frame
12.Relayout(pack) the controls