welle has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks
I am trying to resize the columns of a Tablematrix according to the size of the main window and the (variable number of columns)
This is what I have so far:
First I create a simple Tablematrix table, then I set the width of my main Window (full screen)
my $sw = $mw->screenwidth; my $sw_new=int($sw*.99); $mw->geometry("${sw_new}x400+0+0");
I do my Tablematrix rezising here. The rezising of the table's column should be proportionally to the width of the window. If window is x and I have 2 columns, each column shold be x/2, if I have 3 columns each column should be x/3, etc...
if ($number_of_columns_in_GUI=~2){ my $col_new=int($sw*.50); $t->colWidth( 0=> $col_new, 1=> $col_new, 2=> 0); } if ($number_of_columns_in_GUI=~3){ my $col_new=int($sw*.33); $t->colWidth( 0=> $col_new, 1=> $col_new, 2=> $col_new, 3=> 80); }
Of course, this doesn't work. Window width is not appropriate to set the (I think) character number of a tablematrix column.
Any idea on how I could solve this? Thank you
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: proportional resizing tk table
by kcott (Archbishop) on Aug 05, 2011 at 00:40 UTC | |
Re: proportional resizing tk table
by Marshall (Canon) on Aug 05, 2011 at 12:22 UTC | |
by welle (Beadle) on Aug 06, 2011 at 11:55 UTC |