http://www.tcl.tk/man/tcl8.5/TkCmd/frame.htm ---- [Jeffrey Hobbs] has written, "The whole container/use idea is nice, but was only pushed far enough to enable embedding Tk into Netscape/IE. There are definite problems with handling focus and message passing ..." So I guess it is up to the Tk community to jump in and improve this capability? Let's use "[Combining GUI applications developed with Tk and 'native' Windows toolkits]" as a home for such progress. ---- **Size managed by grid/pack** One of the purposes of frame-like widgets (frame, ttk::frame, ttk::labelframe) is to contain other widgets by the use of the pack or grid geometry manager. The requested size of the frame is set by grid/pack if "grid/pack propagate" is on: ====== % pack [frame .f] % winfo reqheight .f 1 % pack [entry .f.e] % winfo reqheight .f 19 ====== An eventual <> event on .f would fire. Now with propagation off: ====== % pack [frame .f] % pack propagate .f 0 % winfo reqheight .f 1 % pack [entry .f.e] % winfo reqheight .f 1 ====== An eventual <> event on .f would not fire. There is one exception: when the last children is unpacked/gridded, the frame is not resized, see below. ---- **Frame does not shrink to 1 height if last children is unpacked/ungridded** [HaO] 2016-09-07: (issue is present with [pack] and [grid] and with [frame], [ttk::frame] and [ttk::labelframe]) Giving a frame with two children: ====== % pack [frame .f -height 1] % winfo reqheight .f 1 % pack [entry .f.e1] [entry .f.e2] % winfo reqheight .f 38 ====== When on children is unpacked, the frame resizes to the size required by the other children: ====== % pack forget .f.e1 % winfo reqheight .f 19 ====== When the last children is unpacked, the frame does not resize: ====== % pack forget .f.e2 % winfo reqheight .f 19 ====== -> The frame keeps the size of the entry widget. To avoid this effect, there are two solutions on clt (Thread "frame auto resize to 0 if forgetting packed subwidget", date 2016-09-05): ***Solution 1: pack an invisible frame*** [bll]: Just pack a dummy frame in the collapsing frame: ====== pack [frame .f] [frame .f.d] pack [entry .f.e1] [entry .f.e2] ====== ***Solution 2: set -height of the frame to 1*** [Alexandru Dadalau] I use the -height property in order to shrink the frame back after the "pack forget". ====== pack forget .f.e2 .f configure -height 1 ====== This works without a dummy widget but shows a frame of height 1. ***Explanation by Joe English on CLT*** Frame widgets normally don't request a size of their own, to avoid fighting with the geometry manager if they contain slaves (which is the normal case). But if the last slave is removed, the geometry manager no longer controls the size of the master and makes no further size requests. So with nobody making size requests for the frame, it'll just stay at whatever size it happens to be at the time, until something else triggers geometry propagation, such as the user explicitly configuring a (nonzero) -width or -height, or adding a new slave window. > What is the purpose of this behaviour ? Bug or feature ? I suspect it's just how things work; this seems like a corner case that was probably never considered and for which there's no obvious right answer. ***TIP and solutions*** [http://tip.tcl.tk/454%|%TIP 454%|%] proposes advanced solutions for this issue: * Change grid/pack so the frame resiszes automatically to reqsize 1x1 [https://core.tcl.tk/tk/info/d6b95ce49207c823%|%Ticket d6b95ce49207c823%|%] and branch [https://core.tcl.tk/tk/timeline?r=bug-d6b95ce492-alt&unhide%|%bug-d6b95ce492-alt%|%] * (Rejected alternatives) Add a virtual event [https://core.tcl.tk/tk/info/2863003fffffffff%|%Ticket 2863003fffff%|%] and branch [https://core.tcl.tk/tk/timeline?r=bug-d6b95ce492&nd&c=2016-09-21+06%3A32%3A55&n=200%|%bug-d6b95ce492%|%] Even voted 'yes' in 2016-10 for TK 8.6.7, the TIP will probably never be merged due to compatibility issues: * eventuall flickering * the additional <> event may break complicate setups * programs may rely on this mis-feature like just setting a frame size on the size of another widget (grid .f.e grid forget .f.e) ---- * [A scrolled frame] * [Scrolled.frame] * Note that 8.4 introduces a [labelframe] * [Frame Background Image] * [ttk::frame] * [ttk::labelframe] <> Widget | Command | Tk syntax help | Arts and Crafts of Tcl-Tk Programming