Tk packing problem, in_ parameter fails?
Russell E. Owen
owen at nospam.invalid
Fri Aug 9 11:29:34 EDT 2002
Typically if I want to display a widget in its own window (Toplevel), I
create the Toplevel first, then create the widget with the Toplevel as
its master. However, sometimes it would be more convenient to create the
widget first, then the Toplevel. Both grid and pack offer an "in_"
parameter that is supposed to allow one to grid or pack a widget
someplace other than inside its parent. However, when I try to use it,
it fails.
Example:
>>> from Tkinter import *
>>> root = Tk()
>>> tl = Toplevel(root)
>>> wdg = Label(master=root, text="Test")
>>> wdg.pack(in_=tl)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/sw/lib/python2.2/lib-tk/Tkinter.py", line 1587, in
pack_configure
self.tk.call(
TclError: can't pack .7358896 inside .7355136
Any idea what's how to make in_ work? Or how to solve the problem a
different way? Is it possible to change the parent of an existing widget?
-- Russell
More information about the Python-list
mailing list