I am using BWidget
's ScrolledWindow
in a code like this:
toplevel .top
set w [ScrolledWindow .top.scrolledWindow]
set f [ScrollableFrame $w.scrollableFrame -constrainedwidth true]
$w setwidget $f
set a [$f getframe]
# here goes some stuff in $a
So I get a window with vertical scrollbar. When increasing the height of .top
, after some moment all the content in $a
becomes visible and the scrollbar disappears as it is not needed anymore. How can I forbid further increasing the height of .top
? i.e. I need to set the maximum height of .top
to the value when all content of $a is visible. How can I do that ?
To set the maximum height of a toplevel, you use
wm maxsize
, possibly with a very large value for the horizontal size. To get the current size of it, you usewinfo height
(andwinfo width
in the other dimension). Combining these:Now, the tricky bit with BWidget is that it doesn't set the size of the window immediately, or even on first display. This means that you have to put in a guess about when to configure the window. A cheap thing to try is to put it half a second in the future; after all, even expert users are likely to spend at least a little while looking before interacting with it. That's done with
after
like this: