This is a general question about Tk so please forgive me that there is no code posted. I wrote a small Tcl/Tk GUI that consists of an entry, a couple of checkbuttons, a radiobutton and a button widgets. I need to run a specific proc when any of these widgets change to check the state of all the widgets and do something. Like when checkbutton is checked or something is typed in the entry widget and so on.
I could achieve a desired behavior by using widget specific options like -command for checkbutton and radiobutton, -validatecommand for entry and so on. The issue that I have with this implementation is that this is not quite transparent and readable.
Would it be possible to use bind command or something else to invoke a script on a widget change?
NOTE: I realize that I can bind things like <KeyRelease> and <ButtonRelease> but I would like to trigger the script only when a widget is actually changed.
Thank You
Use -variable and -textvariable options (the latter for the entry, the former for checkbuttons and radiobuttons). Let the variables backing all your widgets be members of the same array. Then use
traceon the entire array to handle variable updates.