I should have waited a bit longer before posting. I found the answer.

The event to bind is Configure.

Just bind a callback to a Configure event on your widget, and you can reconfigure as you please.

What surprised me was that I could call the widget's configure method in the ConfigureConfigure callback without creating infinite recursion.

The code below shows the technique.

use strict; use warnings; use Tk; my $mw = MainWindow->new(); my $long_text = <<EOT; Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Pellentesque + dictum tempor augue. Sed id pede. Suspendisse a erat a risus tincidu +nt rhoncus. Integer eget risus. Nulla nunc odio, viverra eget, consec +tetuer non, mollis at, felis. In hac habitasse platea dictumst. Nulla + accumsan volutpat eros. Vivamus convallis, eros ut convallis facilis +is, justo ipsum convallis orci, vehicula laoreet purus eros eget ante +. In tempor. Proin varius placerat nisl. Class aptent taciti sociosqu ad litora torquent per conubia nostra, pe +r inceptos hymenaeos. Aenean pretium augue ac nulla. Praesent ante ri +sus, iaculis et, malesuada a, luctus in, orci. Sed erat odio, auctor +sed, molestie vel, volutpat at, elit. Phasellus fermentum ultricies e +st. Aenean interdum elit sit amet est. Donec luctus lacus a turpis. S +ed et risus. Fusce metus. Pellentesque lorem dolor, volutpat in, cong +ue id, luctus et, magna. Nullam congue sagittis orci. Pellentesque ne +c metus. Nulla nulla. EOT my $l = $mw->Label( -text => $long_text, -wraplength => 250, )->pack( -fill => 'both', -expand => 1, ); $l->bind( '<Configure>', => [ \&ResizeMe, Ev('w') ] ); sub ResizeMe { my $l = shift; my $w = shift; # Amazingly, this does not lead to infinite recursion. $l->configure( -wraplength => $w ); } MainLoop;

Update: I forgot to mention, that I figured this out by looking at the Tk::bind POD. The section called "BINDING CALLBACKS AND SUBSTITUTIONS" includes an entry for the 'w' character which returns a width for an event. The event list includes Configure, as does the h/height entry. So, I figured, maybe Configure events are generated when a widget is resized. I tried a quick binding and it worked.


TGI says moo


In reply to Re: Handling resizing in pTk by TGI
in thread Handling resizing in pTk by TGI

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.