Tkinter question: disappearing label using the packer?

Fredrik Lundh fredrik at pythonware.com
Tue Apr 24 13:02:03 EDT 2001


Jake Baker wrote:

> This does not work: (place()ing in a nested Frame object)
>
> =begin=
>
> from Tkinter import *
> root = Tk()
> frame = Frame(root, bg='white')
> frame.pack()
> label = Label(frame, text='Hello world!')
> label.place(x=0)
> root.mainloop()
>
> =end=

if you use pack or grid, the parent widget is resized as
necessary (this is called "geometry propagation").

if you use place, you have to set the size of the parent
yourself.

try giving the frame a size:

    frame = Frame(root, bg='white', width=100, height=100)

Cheers /F





More information about the Python-list mailing list