A little kludgy perhaps, but I think this is possibly what you are trying to do...
Note: the $mw->update before binding the <Configure> is necessary to avoid all the configure events generated during widget construction.
Update: Added the eventGenerate to load values so maximizing the window will keep the ratio even if the window hasn't been resized first. Also removed unnecessary binding to <ButtonPress-1>.
#!/usr/local/bin/perl -w use Tk; use strict; require Tk::TFrame; require Tk::Adjuster; my ( $mw, $frmLeft, $adjMiddle, $frmRight, ); $mw = MainWindow->new( -title => 'foo' ); $frmLeft = $mw->TFrame( label => [ -text => 'links' ] )->pack( -expand => 1, -fill => "both", -side => 'left' ); $adjMiddle = $mw->Adjuster( -widget => $frmLeft, -side => 'left', -restore => 1, )->pack( -side => 'left', -fill => 'y' ); $frmRight = $mw->TFrame( label => [ -text => 'rechts' ] )->pack( -expand => 1, -fill => "both", -side => 'right' ); ###### Added bit ################################### $mw->update; my ( $mw_width, $ratio ); $mw->bind( $mw, '<ButtonRelease-1>' => sub { undef $ratio } ); $mw->bind( $mw, '<Configure>' => sub { $mw->XEvent; my $width = $mw->width; $mw_width = $width unless $mw_width; if ( $width != $mw_width ) { $ratio = ( $frmLeft->cget( -borderwidth ) + $frmLeft->width + $adjMiddle->width / 2 ) / $mw_width unless $ratio; $frmLeft->configure( -width => int( $width * $ratio ) ); $mw_width = $width; } } ); $mw->eventGenerate('<Configure>'); ####################################################### MainLoop;
In reply to Re: Tk::Adjuster, how to keep proportions
by thundergnat
in thread Tk::Adjuster, how to keep proportions
by holli
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |