Tkinter/Pmw Pack Question
Matthew Dixon Cowles
matt at mondoinfo.com
Thu Oct 4 15:42:29 EDT 2001
On 4 Oct 2001 09:48:05 -0700, Jeffrey <jmsun at bioeng.ucsd.edu> wrote:
Dear Jeff,
>Hi,
Hi!
>I'm using a the pack function to show my widget in it's parent
>widget. But I wanted to make it so that the child widget and go from
>it's parent widget to another widget. So in essence in can move
>around....
The packer has the option in_ that's not much used but will do what
you want:
>>> from Tkinter import *
>>> r=Tk()
>>> f1=Frame(r,width=100,height=100,bg="blue")
>>> f1.pack_propagate(0)
>>> f1.pack()
>>> f2=Frame(r,width=100,height=100,bg="green")
>>> f2.pack_propagate(0)
>>> f2.pack()
>>> l=Label(r,text="Wibble")
>>> l.pack(in_=f1)
>>> l.pack(in_=f2)
Note that when you create the Label, its parent widget needs to be a
widget that's a parent of both of the widgets that you want to put the
label in.
Regards,
Matt
More information about the Python-list
mailing list