I have a question on the trace method for multiple variables. I want to disable a button "run" when StringVar is an empty value. I used the trace method but this will only trace separately each variable but does not consider combo of two. For example, one scenario, I change two values to empty strings in the entry widget and than I change one of them to a number,the other one is still an empty string, as the result the button will be enabled. How will I keep the button disabled in this scenario?
self.var_5_x.trace("w", self.on_entry_trace_x)
self.var_3_y.trace("w", self.on_entry_trace_y)
def on_entry_trace_x(self, *args):
new_state = "disabled" if self.var_5_x.get() == "" else "normal"
self.button_1.configure(state=new_state)
def on_entry_trace_y(self, *args):
new_state = "disabled" if self.var_3_y.get() == "" else "normal"
self.button_1.configure(state=new_state)