Tkinter: why does an empty frame not shrink?

Greg McFarlane gregm at iname.com
Fri Jun 25 02:29:38 EDT 1999


If you have several child widgets packed in a frame and you unpack the
children one by one, the frame will gradually get smaller, except when
the last child is unpacked, in which case the frame does not resize. 
Does anyone know why the frame does not shrink to 0x0 when you unpack
the last child?  Any soluton?

Example script:
============================================================
import Tkinter

root = Tkinter.Tk()
root.geometry('400x400')

frame = Tkinter.Frame(background = 'red')
frame.pack(fill = 'x')

for i in range(5):
    button = Tkinter.Button(frame, text = 'Unpack me')
    button.configure(command = button.pack_forget)
    button.pack()

root.mainloop()
============================================================

-- 
Greg McFarlane:    INMS Telstra Australia (gregm at iname.com)
Today's forecast:  Sunny, with occasional cloudy periods and a chance
		   of precipitation in some areas.




More information about the Python-list mailing list