I am not sure to understand what you are trying to achieve, but the two options I can think are
- iterate through each widget and compare to reference values (the one you evoke in your question)
- bind to edits on those widgets and either store new values, or handle a list of edited widgets
The usual way to perform the former in GUI is through binding and callbacks. If you use Entry
and ttk.Combobox
, you can handle both with StringVar
and trace
bindings.
Here is a snippet (inspired by this answer) illustrating callback aware of the edited widget. It is up to you to handle a damage list (with the widgets that have been edited) or a data structure with only modified value.
from Tkinter import *
import ttk
def callback(name, sv):
print "{0}: {1}".format(name, sv.get())
root = Tk()
sv = StringVar()
sv.trace("w", lambda name, index, mode, sv=sv: callback("one", sv))
e = Entry(root, textvariable=sv)
e.pack()
sv = StringVar()
sv.trace("w", lambda name, index, mode, sv=sv: callback("two", sv))
e = Entry(root, textvariable=sv)
e.pack()
sv = StringVar()
box = ttk.Combobox(root, textvariable=sv)
box.pack()
box['values'] = ('X', 'Y', 'Z')
box.current(0)
sv.trace("w", lambda name, index, mode, sv=sv: callback("three", sv))
root.mainloop()