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


In reply to proportional resizing tk table by welle

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.