Tkinter button command question
Phil <[email protected]>
| Newsgroups | gmane.comp.python.tutor |
|---|---|
| Message-ID | <[email protected]> |
This is a confusing problem so I'll do my best to explain it clearly. I have created a Tkinter app that consists of two classes; an App and an Entry class. The entry class has a variable named self.a and is set like this: self.a = "". Each class has an identical function named solve(). The Entry class has a button defined as follows: solve_button = customtkinter.CTkButton( self, text="solve", width=80, #command=self.solve, command=self.master.solve, # This calls the App class solve function ) If the command calls the Entry class solve() then self.a = "x" (self.a is set to "x" before the solve button is pressed). If the command calls the App class solve then self.a = "", the initial value of self.a. I hope that someone can offer a working suggestion because I've reached the limit of my ability. By the way, my AI friend suggested "command=self.master.solve" but cannot offer a working solution that solves the problem. self.a = "x" when command=self.solve and self.x = "" when command=self.master.solve. I should mention that I have stepped through the code with the debugger and the App class solve() is called after the button is pressed and after self.a is set to "x". -- Regards, Phil _______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor