[Tkinter-discuss] question on scalable frame
jepler at unpythonic.net
jepler at unpythonic.net
Tue Mar 7 17:24:06 CET 2006
Once the user has adjusted the size of the window, many window managers
keep the window at the user-requested size, rather than the
application-requested size.
By setting an empty geometry when resizing the window, this behavior
can be avoided, at least on my system. e.g., in python,
app.wm_geometry("")
Here's a wish program that demonstrates the solution (and the problem,
if the "wm geo" section is commented out):
#------------------------------------------------------------------------
label .l -width 10 -bg red
button .b -text "<<" -command {width -1}
button .b1 -text ">>" -command {width 1}
proc width arg {
set w [.l cget -width]
incr w $arg
if {$w < 0} { set $w 0 }
.l configure -width $w
# Reset window to use application, not user, size
# Comment this out to show the problem or do something more sophisticated
# (like check if the new requested size is greater than the current size, so
# as to grow but not shrink)
wm geometry . {}
}
pack .l -side top
pack .b -side left
pack .b1 -side left
#------------------------------------------------------------------------
Jeff
More information about the Tkinter-discuss
mailing list