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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.