Tkinter: why does an empty frame not shrink?
Rob Hooft
Rob.Hooft at p98.f112.n480.z2.fidonet.org
Thu Jul 1 08:30:24 EDT 1999
From: R.Hooft at EuroMail.com (Rob Hooft)
>>>>> "GM" == Greg McFarlane <gregm at iname.com> writes:
GM> If you have several child widgets packed in a frame and you
GM> unpack the children one by one, the frame will gradually get
GM> smaller, except when the last child is unpacked, in which case
GM> the frame does not resize. Does anyone know why the frame does
GM> not shrink to 0x0 when you unpack the last child? Any soluton?
In one of my applications, I put the frame inside another frame, and
resize the empty container frame to 1x1 manually to solve this. Ugly,
but it works:
def makeWidgets(self,fn=None):
self.rightbarvar=variables.booleanvariable() # used in a menu entry
self.rightbarvar.set(1)
....
self.rightbarc=Tkinter.Frame(self)
self.rightbarc.pack(expand=Tkinter.NO,fill=Tkinter.Y,side=Tkinter.RIGHT)
self.rightbar=Tkinter.Frame(self.rightbarc)
self.rightbar.pack(expand=Tkinter.NO,fill=Tkinter.Y,side=Tkinter.RIGHT)
....
def togglerightbar(self):
if self.rightbarvar.get():
self.rightbar.pack(expand=Tkinter.NO,fill=Tkinter.Y,side=Tkinter.RIGHT)
else:
self.rightbar.pack_forget()
self.rightbarc.configure(width=1,height=1)
Regards,
Rob Hooft
--
===== R.Hooft at EuroMail.net http://www.xs4all.nl/~hooft/rob/ =====
===== R&D, Nonius BV, Delft http://www.nonius.nl/ =====
===== PGPid 0xFA19277D ========================== Use Linux! =========
More information about the Python-list
mailing list