#self. Self.protocol("WM_DELETE_WINDOW", self.on_exit) I have created a tkinter GUI that uses a button callback to open another window (other searches say this window should be a top-level window) and it works pretty good, how-ever each time the button is pressed it opens another identical (as far as I can tell) window. Msg = "".format(self.winfo_name().title()) ("Test exist", 0, self.on_test_exist, ""),įor index, text in enumerate(self.voices):į0.pack(fill=tk.BOTH, expand=1, padx=5, pady=5)į2.pack(side=tk.RIGHT, fill=tk.Y, padx=5, pady=5, expand=0)į1.pack(side=tk.LEFT, fill=tk.Y, padx=5, pady=5, expand=0) ("Get winfo_children", 0, self.on_get_winfo_children, ""), If self.nametowidget(DICT_TOPLEVELS).winfo_exists():įile "/usr/lib/python3.7/tkinter/_init_.py", line 1353, in nametowidgetīasically in an application with many Toplevels, how do you see if a certain Toplevel is open? Selecting a Toplevel to test using the radiobox on the right happens that if the relative Toplevel is open the function work fine, otherwise generates the following error: Exception in Tkinter callbackįile "/usr/lib/python3.7/tkinter/_init_.py", line 1705, in _call_įile "/home/bc/Desktop/simple_app.py", line 113, in on_test_exist Pressing on the first appears a mask where we can, by pressing the relevant buttons, see the execution of both the winfo_exists() method and the winfo_children() method. When you open the app, four buttons are shown. I enclose a script to better clarify what I would like to do. However, I cannot test the existence of a Toplevel by passing the name of this to winfo_exists() method. I’m trying to test the existence of a toplevel using the winfo_exists() method made available by Tkinter.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |