in reply to Tk main window protocole maximize

You can get the new size when it is changed by binding to Configure.

Here's an example that does that:

#!/usr/bin/perl # http://perlmonks.org/?node_id=1213422 use strict; use warnings; use Tk; my $mw = MainWindow->new; my $c = $mw->Canvas( -width => 400, -height => 400, -bg => 'red', -highlightthickness => 0, )->pack; for my $row (0..7) { my $color = $row % 2; for my $col (0..7) { $c->createRectangle($row*50, $col*50, $row*50+50, $col*50+50, -fill => qw( gold2 green)[$color++ % 2], -outline => undef, ); } } $mw->bind('<Configure>' => sub { print "width ", $mw->width, " height ", $mw->height, "\n"; } ); MainLoop;