Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > comp.lang.perl.tk > #281

Maximize widget sizes

From Josef Möllers <josef@invalid.invalid>
Newsgroups comp.lang.perl.tk
Subject Maximize widget sizes
Date 2025-08-16 22:59 +0200
Message-ID <mgc9pcFhg8jU1@mid.individual.net> (permalink)

Show all headers | View raw


Hi,

I have a little Perl/Tk program that runs on a 480x320 LCD display on 
top of a RasPi.

I create a new MainWindow:
my $mw = MainWindow->new;

and then populate it with widgets which I arrange in a grid:

my ($row, $col) = (0, 0);
foreach (@items) {
     my $name = shift @$_;
     my $label = shift @$_;
     my $func = shift @$_;

     $button{$name} = $mw->Button(-text => $label, -command => [ $func, 
@$_ ])->grid(-row => $row, -column => $col, -sticky => 'news');
     $col++;
     if ($col == $MAXCOLUMNS) {
         $row++;
         $col = 0;
     }
}
if ($col != 0) {
     $row++;
}
my $status = $mw->Entry(-relief => 'sunken')->grid(-row => $row, -column 
=> 0, -columnspan => 2, -sticky => 'news');
$row++;
$mw->Checkbutton(-text => "Erase after copying", -variable => 
\$erase_after_copying)->grid(-row => $row, -column => 0, -columnspan => 
2, -sticky => 'news');
$row++;
$mw->Button(-text => 'Shutdown', -command => sub { system("sudo 
poweroff") })->grid(-row => $row, -column => 0, -columnspan => 2, 
-sticky => 'news');

My problem is that the resulting window and the buttons inside are 
fairly small. I tried making the MainWindow larger:
$mw->geometry('400x250');
but the buttons do not grow with the MainWindow. They still have the 
same size as without the geometry change.

What do I need to do to have all the widgets grow to fill the large 
MainWindow?

Thanks in advance,

Josef

Back to comp.lang.perl.tk | Previous | NextNext in thread | Find similar


Thread

Maximize widget sizes Josef Möllers <josef@invalid.invalid> - 2025-08-16 22:59 +0200
  Re: Maximize widget sizes ram@zedat.fu-berlin.de (Stefan Ram) - 2025-08-16 22:16 +0000
    Re: Maximize widget sizes Josef Möllers <josef@invalid.invalid> - 2025-08-17 10:16 +0200

csiph-web