#!/usr/bin/perl use Tk; my $mw = MainWindow->new; $mw->bind( "" => sub { print "reconfigure ".ref($_[0])."\n" } ); my $topFr = $mw->Frame ->pack( -fill => "both", -expand => 1 ); $topFr->Button( -text => "bigger", -command => sub { changeSize(50) } ) ->pack( -side => "bottom", -expand => 1 ); $topFr->Button( -text => "smaller", -command => sub { changeSize(-50) } ) ->pack( -side => "bottom", -expand => 1 ); my $interior = $topFr->Frame( -label => "Hello world", -height => 100, -width => 100, -background => "white", -relief => "groove" ) ->pack( -side => "bottom", -fill => "both", -expand => 1 ); $interior->packPropagate(0); MainLoop; sub changeSize { my ($sizeDelta) = @_; $interior->configure( -width => $interior->width+$sizeDelta, -height => $interior->height+$sizeDelta ); printf("interior %d x %d, topFr %d x %d\n", $interior->width, $interior->height, $topFr->width, $topFr->height ); }