Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Want Tk to fully display 4x6 widget w/ grid instead of collapsing it

by physgreg (Scribe)
on Oct 25, 2002 at 13:04 UTC ( [id://207981]=note: print w/replies, xml ) Need Help??


in reply to Want Tk to fully display 4x6 widget w/ grid instead of collapsing it

You need to change your gridColumnconfigure and gridRowconfigures to use the '-minsize' attribute. '-weight' just controls how the cells respond to the grid being resized. As an example:
for (my $i = 0; $i < $rows; $i++) { $tl->gridRowconfigure($i, -weight => 1, -minsize => 80); }
would make your cells always at least 80 pixels wide. All you have to do is make sure that minsize is greather than or equal to the largest widget.

I have used this (many times!) in TCL/Tk, but not in Perl/Tk. However, I can't see why it wouldn't work.

  • Comment on Re: Want Tk to fully display 4x6 widget w/ grid instead of collapsing it
  • Download Code

Replies are listed 'Best First'.
Re: Want Tk to fully display 4x6 widget w/ grid instead of collapsing it
by ff (Hermit) on Oct 25, 2002 at 14:11 UTC
    Oh beautiful for spacious columns!

    Thank you! I commented away the dummy cell creation and added a "-minsize => 13" to "gridRowconfigure". At first I played with "gridColumnconfigure" because I thought I had a "column" problem. But my "column" problem was actually stemming from the individual rows not having to maintain a minimum height. Code is now fixed per your suggestion. Thanks! :-)

    P.S. I start the toplevel with a certain geometry, which I must adjust a bit (as you forsaw). Since the original geometry didn't leave enough space for each row to accomodate the new -minsize, some rows had widgets whose text/height was cropped. Enlarging geometry from 630x423+113+74 made all my widgets happy again.

    for (my $i = 0; $i < $rows; $i++) { $tl->gridRowconfigure($i, -weight => 1, -minsize => 13 ); } $tl->geometry( 630x461+113+74 );

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://207981]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2024-04-24 07:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found