in reply to Tk ASCII Table

Hi!

Your code can be shortened a bit:

use strict; use warnings; use Tk; my $columns_per_row = 12; sub ASCII_Buttons { my $root = MainWindow->new(); $root->title('MMG Server Options'); my ($row,$col) = (1,1); for my $character (0..255) { my $label = sprintf("[%03d][%s]", $character, chr($character)) +; $root->Button( -text=>$label, -font => '-*-Lucida Console-Bold-R-Normal-*-*-160-*-*- +*-*-*-*', )->grid(-row=>$row,-column=>$col,-sticky=>'nswe'); if ($col>=$columns_per_row) {$row++;$col=0} $col++; } } ASCII_Buttons(); MainLoop;

Regards, mawe

Replies are listed 'Best First'.
Re^2: Tk ASCII Table
by NateTut (Deacon) on Jun 08, 2005 at 13:08 UTC
    Thanks, I've always wondered if the grid stuff had to come after. I picked up the two step method from my use of SpecTcl to generate the basic UI.