Entry
From within a function, is there a way to determine what the parent of a calling widget is?
Aug 22nd, 2000 00:49
unknown unknown, Mark Tipton, Richard Chamberlain
from Tkinter import *
root=Tk()
frame=Frame(root)
button=Button(frame,text='Click Me')
button.pack()
frame.pack(fill=BOTH,expand=1)
def clicker(event):
event.widget.master.configure(bg='blue')
button.bind('<Button>',clicker)
root.mainloop()
If you bind an event you have access to the calling widget via
event.widget, so you have access to the calling widget's parent via
event.widget.master.