in reply to Tk:Text resize dillema

Hi again, I'm not sure exactly what you are trying to do, but the thought just occured to me, that if you really want scalable text, you might be better off using Tk::Zinc. It will let you scale text (which most other Toolkits don't allow). Now the example below is very simplistic, BUT you could work out an automatic sizing sub, where if you are given the pixel dimensions of the entire box, you could keep scaling the text, and checking it's bbox values, until it just fit into the display box. This is all frought with difficulties, like some fonts look ugly when scaled, etc. Anyways, left-click will zoom, right-click will shrink.
#!/usr/bin/perl use warnings; use strict; use Tk; use Tk::Zinc; my $mw = MainWindow->new(); $mw->geometry($mw->screenwidth . 'x' . $mw->screenheight . '+0+20'); $mw->title("Text Scale Test"); my $zinc = $mw->Zinc( -height => $mw->screenheight, -width => $mw->screenwidth, -backcolor => 'black', -relief => 'raised' )->pack(); $zinc->fontCreate( "fonta", -family => 'arial', -size => -30, -weight => 'bold' ); my $text = $zinc->add('text',1, -position => [$mw->screenwidth/2 , 75 ], -text => 'foobar foobaz', -composescale => 1, -anchor => 'center', -color => 'hotpink', -font => 'fonta', ); $mw->bind( '<ButtonPress-1>', sub { &move } ); $mw->bind( '<ButtonPress-3>', sub { &move1; } ); #my $id = $mw->repeat(75, sub{ &move } ); MainLoop; sub move { # $zinc->translate($text,0, 1); $zinc->scale( $text, 1.1, 1.1); } sub move1 { # $zinc->translate($text,0, 1); $zinc->scale( $text, .9, .9); } __END__

I'm not really a human, but I play one on earth. Cogito ergo sum a bum