Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Tkx - new_table - how to resize columns ?

by x-lours (Sexton)
on May 16, 2018 at 10:13 UTC ( #1214625=perlquestion: print w/replies, xml ) Need Help??

x-lours has asked for the wisdom of the Perl Monks concerning the following question:


I'm forced to use Tkx (ActivePerl). I can't move to Tk neither upload any module. The firewall of the company prevent any upload.

I'm looking for a way to change the size of the columns in a table (new_table).
I need to fit the size of :

    The column 1 to 2
    The column 2 to 10
    The column 3 to 5
    The column 4 to 5

but the 4 columns are always with the same size !

here is a skeleton of a script

#!/usr/bin/perl -- use strict; use warnings; use Tkx; Tkx::package_require("Tktable"); my $mw = Tkx::widget->new("."); my %hash = ( # data to display for example '1,0' => 'Vertical', '2,0' => 'Lng', '3,0' => 'Lateral', '0,1' => 'Expected shifts (A)', '0,2' => 'Shifts based on img alignment (B)', '0,3' => '|A-B|', ); my $t = $mw->new_table ( -rows => 4, -cols => 4, -cache => 1, -variable => \%hash, ); $t->g_grid(-column => 0, -row => 0, -sticky => "news"); # what i try but did'nt work... $t->g_grid_columnconfigure(0, -weight => 2); $t->g_grid_columnconfigure(1, -weight => 10); $t->g_grid_columnconfigure(2, -weight => 5); $t->g_grid_columnconfigure(3, -weight => 5); Tkx::MainLoop();

any help is granted ;-)

best regards
x-l'ours (a frenchy)

Replies are listed 'Best First'.
Re: Tkx - new_table - how to resize columns ?
by johngg (Canon) on May 16, 2018 at 15:18 UTC

    I've never had to use Tkx so I had a Google about and got rather confused as there appear mentions of modules named with the same letters but different cases; Tktable, TkTable, tkTable and tktable. Are they perhaps all versions of the same basic module or are they reinventions of the same wheel?

    Your mention of ActiveState and your code implies that you are using this. No longer (not for years) having any ActiveState instance installed, I can't check in the documentation. Looking at the package details (browse to a particular architecture version) suggests that it is derived from this and again I could find no documentation.

    The only useful documentation I could discover was this but in it I could see no method that would allow sizing of individual columns, all column-specific methods seem to apply globally. I hope the references I've found will help you to investigate further and find something more useful.



      a enormous thank you ;-)
      thank to you i found my answer in the page
      that i can act on width even whith specifying a column

      adding this

      $t->width(0, 10); $t->width(1, 50); $t->width(2, 20); $t->width(3, 20);
      in place of the 4 lines $t->g_grid_columnconfigure(n, -weight => x); make my day !

      i can close this tip

Re: Tkx - new_table - how to resize columns ?
by Anonymous Monk on May 16, 2018 at 23:37 UTC
    Mail yourself or usb Tk and modules you need, obviously

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1214625]
Front-paged by Corion
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2023-06-04 01:48 GMT
Find Nodes?
    Voting Booth?
    How often do you go to conferences?

    Results (17 votes). Check out past polls.