| Store | Cart

Re: [TCLCORE] ttk::panedwindow pane -stretch option

From: Sam Bromley <s...@sambromley.com>
Thu, 10 Sep 2015 17:03:36 -0230
On 2015-09-10 04:06 PM, Joe English wrote:
> Sam Bromley wrote:>> [...]>> I'm fighting with layout management with ttk::panedwindow>> and desiring the behaviour of tk::panedwindow pane -stretch>> option (TIP#177), which looks to not be available in Ttk.>>>> Is there currently an intent to have similar behaviour available>> to ttk::panedwindow? Or is there an alternative solution I>> should learn about?> > Each pane in a ttk::panedwindow has a  '-weight' option,> similar to row and column weights in the [grid] geometry manager.> > If a pane has -weight 0, it will not shrink or stretch when the> master is resized; with -weight 1 it will.  Weights other than> 0 and 1 may be specified to make certain panes stretch faster> or slower than others, and if all panes have -weight 0, any> extra space is allocated to the last pane.  Lastly, it tries> to do something sensible if the master window is shrunk below> the minimum required size.> > > --Joe English> >   jeng...@flightlab.com> 

Thanks Joe for your timely response.

I've played around with the weights a fair
bit before finding that it wasn't behaving as desired.
Specifically, when I specify -weight 0 for the bottom
frame, and later pack a widget within that (initially
empty frame), the panedwindow manager will not resize
the bottom frame to show the new content.

If instead, I set a non-zero weight (say 1) to the
bottom frame, and a larger weight (say 10) to the
top frame, then initially, the bottom frame (containing the
empty placeholder frame) (a) still receives space, and (b)
does not resize when said frame is populated with
a larger widget (even though it is clear upon inspection that the
child frame itself has resized to encompass its children.)

The behaviour I seek is this:
1) Start with a two-pane panedwindow, with the top pane containing
widgets, and the bottom pane containing an empty frame. The initial
view should give all space to the top pane, with a sash at the bottom
of the window.

2) I pack a widget into the frame within the bottom pane.
I desire that the panedwindow will reconfigure to accommodate
the new space required in its bottom child frame. But this does not happen.

My reading of the -weights option is that it should apply to "extra"
space not requested by the child widgets. Yet the behaviour appears
to act more like 'all available space'.

Here is some sample code that exhibits the unexpected behaviour:
#!/usr/bin/env wish
ttk::style theme use clam; # To see the sash;
ttk::panedwindow .pw -orient vertical;
pack .pw;
.pw add [ttk::label .pw.l -text TOP -width 10] -weight 1;
.pw add [ttk::frame .pw.f -height 5] -weight 1;
# Force the GUI to update at this stage (without the
# next line, things will work);
update idletasks;
# Paned window clearly gives space to .pw.f;
pack [ttk::label .pw.l2 -text BOTTOM -width 10] -in .pw.f -expand true
-fill both;
# Here there is no change at all in the appearance. (.pw.l2 does not
become visible.)

How do I force a geometry update for the panedwindow?
Any insight would be greatly appreciated!

Thank you,
Sam







------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
_______________________________________________
Tcl-Core mailing list
Tcl-...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tcl-core

Recent Messages in this Thread
Sam Bromley Sep 10, 2015 05:50 pm
Joe English Sep 10, 2015 06:36 pm
Sam Bromley Sep 10, 2015 07:33 pm
Joe English Sep 11, 2015 11:04 pm
Sam Bromley Sep 12, 2015 01:17 am
Messages in this thread