![]() ![]() Self.button = tk.Button(self, text="Open a new window", command=self. This is a small working example where you can see how it would work: import Tkinter as tk To set this attribute to None when you close the window, you can use the protocol method to set a callback. ![]() Even Tkinter has lots of classes with its respective methods, so it looks like it is necessary for your purpose.īack to your question, a solution could be setting the Toplevel window as an attribute of a class where you wrap all your application, and only open a new window if this attribute is None. The second time this procedure is called, there will be an error message box pop up. It can take any of a number of different forms. Hi, Tcl/Tk masters: If I have a procedure which will generate a widget. Syntax: widget.winfoexists () Return value: Returns True if widget exists, False otherwise. The winfo()method is used to retrieve information about windows managed by Tkinter. The alternative (global variables and functions everywhere) is not definitely a good approach. This method is used to check if the specified widget exists or not i.e if the widget is destroyed or not. 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. Sooner or later, you'll have to understand object-oriented programming if you want to program in Python successfully. Ive seen almost every post about this issue and nothing solved it. This method is used to check if the specified widget exists or not i.e if the widget is destroyed or not. I am not (yet) a OOP programmer so please avoid that paradigm if possible. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |