in reply to Screen width of string in proportional font

Hi Phil,

try this:

use strict; use warnings; use Tk; my $mw = tkinit; my $s = 'text'; my $b = $mw->BrowseEntry->pack; $mw->Button(-text => 'add entry', -command => sub{$b->insert('end',$s.='-foo'); $b->updateListWidth; } )->pack; MainLoop;

Cheers, Christoph

Replies are listed 'Best First'.
Re^2: Screen width of string in proportional font
by pdsx (Initiate) on Jan 29, 2010 at 19:17 UTC
    Wow! Thanks! I was unaware of the 'updateListWidth' method. However, by looking at a more recent BrowseEntry Manpage I discovered the '-autolistwidth' option which seems to be exactly what I need.

    Thanks, Chris!

    Cheers, Phil