So I have this code snippet:
for p in self.ProductNames:
OptionMenuVar = StringVar()
menu = OptionMenu(self.FrameProducts, OptionMenuVar, *self.ProductNames)
OptionMenuVar.set(p)
AgeVar = StringVar()
AgeEntry = Entry(self.FrameProducts,width=15,textvariable=AgeVar,state="readonly",justify=CENTER)
which generates this UI:
Question
How do I trace changes in OptionMenuVar
and update AgeVar
based on the selected value?
I've read The Variable Classes. I guess I know how to trace changes in OptionMenuVar
but I still don't know how to:
- detect the new value
- update
AgeVar
according to the new value