accessing child Pmw elements
Richard Chamberlain
richard_chamberlain at ntlworld.com
Sun Aug 6 07:38:46 EDT 2000
Matthew Bull wrote:
>
> Hi all,
>
> a quick newbie question how would I access a tk widget which is the
> child of a Pmw Notebook widget??
>
> I've already tried using page() to access the parent but couldn't access
> the child text element it contained.
>
> Does anyone know a quick and easy way of accessing these from the toplevel??
>
> Matt
Hi Matthew,
I may have missed your point, so let me know if I have :) but,
As long as you keep a reference to your widget you can access it
directly, so:
from Tkinter import *
import Pmw
root=Tk()
Pmw.initialise()
notebook=Pmw.Notebook(root)
notebook.pack()
page=notebook.add('My Tab')
entry=Entry(page,width=20)
entry.pack()
root.mainloop()
Obviously you've now got a reference to your Entry, i.e.
entry.config(fg='red')
Richard
More information about the Python-list
mailing list