I have a GUI that is sometimes completly disabled, and after a few seconds reenabled again. (To prevent any user actions during time of saving files etc). I noticed after running the GUI for a while the disabling and reenabling of the ctkComboBox gets slower and slower.
Im not sure how or why, but after isoltating the problem i made a small test script to prove my hyopthesis. And indeed, the script just disables, and then reenables the ctkcombobox, and every disable and reeanabling takes longer than the one before. Is there a fix for that, or am i doing something fundamentally wrong?
import customtkinter as ctk
import time
import threading
import tkinter as tk
root = ctk.CTk()
root.title("Start Screen")
root.minsize(width=400, height=400)
dropdownvar = ctk.StringVar(value="foo")
dropdown = ctk.CTkComboBox(root,values=["foo","bar"],command=None,variable=dropdownvar)
dropdown.place(x=10,y=10)
stopthreadvar = False
def change_states(event=None):
while not stopthreadvar:
starttime = time.time()
dropdown.configure(state="disabled")
dropdown.configure(state="normal")
endtime = time.time()-starttime
print(endtime)
time.sleep(1)
def change_var(event=None):
global stopthreadvar
stopthreadvar = not stopthreadvar
button = ctk.CTkButton(root,text="TEST",command=lambda event=None:threading.Thread(target=change_states).start())
button2 = ctk.CTkButton(root,text="stop thread",command=change_var)
button2.place(x=100,y=100)
button.place(x=10,y=100)
root.mainloop()
I have a GUI that is sometimes completly disabled, and after a few seconds reenabled again. (To prevent any user actions during time of saving files etc). I noticed after running the GUI for a while the disabling and reenabling of the ctkComboBox gets slower and slower. Im not sure how or why, but after isoltating the problem i made a small test script to prove my hyopthesis. And indeed, the script just disables, and then reenables the ctkcombobox, and every disable and reeanabling takes longer than the one before. Is there a fix for that, or am i doing something fundamentally wrong?