paulchernoch has asked for the wisdom of the Perl Monks concerning the following question:

Having mastered the art of specifying a size for a MainWindow when I launch it (using a call to geometry()) I face my newest challenge: resizing the window.

How is it done? I am using a tabbed Notebook widget, and one of the tabs has a wide table. When I switch tabs I need to resize the window programmatically to show the extra data.

This is what I tried that didn't work:
sub resizeMainWindow($$) { my ($width, $height) = @_; $mainWin->configure(-width => $width, -height => $height); }
- Paul

Replies are listed 'Best First'.
Re: Perl TK - How do I resize a MainWindow?
by GrandFather (Saint) on May 19, 2009 at 03:44 UTC

    To resize or reposition the main window use geometry:

    use strict; use warnings; use Tk; my $main = Tk::MainWindow->new (-title => 'Resize demo'); $main->Button ( -text => 'Change size', -command => sub {ChangeSize ($main, @_)}, )->pack (); MainLoop (); sub ChangeSize { my ($wind) = @_; my $newSize = int (100 + rand (100)) . 'x100+100+100'; $wind->geometry ($newSize); }

    True laziness is hard work
      Works like a charm! Thanks.

      - Paul