CustomTkinter
CustomTkinter copied to clipboard
invalid command name "<numbers>update/check_dpi_scaling"
I am creating data reduction software and the general workflow is to view a list of analysis sequences, select one, and then go to view a plot of raw data. I'm getting this cryptic error when I switch from one GUI to the next:
invalid command name "2073977167560update"
while executing
"2073977167560update"
("after" script)
invalid command name "2073972183304check_dpi_scaling"
while executing
"2073972183304check_dpi_scaling"
("after" script)
Here is a reproducible example:
from tkinter import ttk
import customtkinter as ctk
import matplotlib.figure as Figure
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
def create_first_gui():
window = ctk.CTk()
window.title('First GUI')
tree = ttk.Treeview(window)
tree["columns"]=("one","two")
tree.column("#0", width=100)
tree.column("one", width=100)
tree.column("two", width=100)
tree.heading("#0",text="Column A")
tree.heading("one", text="Column B")
tree.heading("two", text="Column C")
tree.insert("", 0, text="Line 1", values=("Stuff 1","Stuff 2"))
tree.pack()
button = ctk.CTkButton(window, text="Proceed to Second GUI", command=window.destroy)
button.pack()
window.mainloop()
def create_second_gui():
window = ctk.CTk()
window.title('Second GUI')
fig = Figure.Figure(figsize=(5, 4))
t = [i/100 for i in range(100)]
fig.add_subplot(111).plot(t, [i**2 for i in t])
canvas = FigureCanvasTkAgg(fig, master=window)
canvas.draw()
canvas.get_tk_widget().pack(side=ctk.TOP, fill=ctk.BOTH, expand=1)
window.mainloop()
create_first_gui()
create_second_gui()
Am I doing something wrong? If so, what?