I am using the customtkinter library to create a button. This button is to close the program.
Here is the definition of the button:
exit_button = ctk.CTkButton(master=main_menu_frame,
text="Exit",
command=root.destroy,
corner_radius=0,
width=WIDTH-40-260,
height=60,
text_font=("century gothic", 16),
)
As you can see the command is equal to root.destroy. And it really closes the window when I click this button, but it give an exception too. Here is the exception:
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py", line 1892, in __call__
return self.func(*args)
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\customtkinter\customtkinter_button.py", line 501, in clicked
self.on_leave()
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\customtkinter\customtkinter_button.py", line 485, in on_leave
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py", line 2903, in itemconfigure
return self._configure(('itemconfigure', tagOrId), cnf, kw)
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py", line 1636, in _configure self.tk.call(_flatten((self._w, cmd)) + self._options(cnf))
_tkinter.TclError: invalid command name ".!ctkframe2.!ctkbutton3.!canvas"
Here is some code to test:
import tkinter as tk
import customtkinter as ctk
root = tk.Tk()
btn = ctk.CTkButton(master=root, text="EXIT", command=root.destroy).pack()
root.mainloop()
With this code I get the same exception.