![]() I don't have code here to test this with, so you should also try to define self.ErrorLabel=None at _init_ too if first method doesn't work. This way it checks if the widget is made and if the widget is not made, then ignores. Then your delete_error() would be: def delete_error(self): What you could do is set ErrorLabel to be None and then check if it is None or not when calling delete_error(), if it is None then ignore, else find its existence. So, Im just making a silly program with TKinter to simulate the DVD bouncing logo, which works, but doesnt change the colors (in this case I have 4 different images. At this point Im not getting an error, its just not working at all. Self.ErrorLabel = tk.Label(ame2, text="Error: check ✔️ the correct answer ", fg='white', bg='red') Ive seen almost every post about this issue and nothing solved it. Self.ErrorLabel = tk.Label(ame2, text="Error: Fill all the blanks !", fg='white', bg='red') This is how it gets assigned: def raise_errors(self, flag): That's why I need to check the existence of it when using grid_forget() ( the assignment of this variable depends if there is an error in input in the program so it doesn't always assign it, ![]() ![]() I don't understand why I get 'not defined' because I'm checking the existence of a object, so it doesn't have to be defined? making '_exists()' into a variable and putting that in if statement.If _exists() = 1: # even with 'self.' removed same error occurs x and y are pixel coordinates relative to the widget. Widget ¶ identify (x, y) ¶ Returns the name of the element at position x y, or the empty string if the point does not lie within any element. This is how I called the function: def delete_error(self): Besides the methods described below, the ttk.Widget supports the methods () and (). winfo_exists(), to check if a widget exists then I get the error: (Not defined) name 'ErrorLabel' not defined winfo_exists() is supposed to return 1 or 0 depending on the existence of a widget
0 Comments
Leave a Reply. |