Entry
From within a function, is there a way to determine what the parent of a calling widget is?
Mar 31st, 2009 09:25
Scott Mandarich, 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.
http://65.182.191.43/d/pump.html