Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ctk.CTkComboBox changing states takes longer for every time state has been changed #2382

Closed
HerrMedizins opened this issue Apr 19, 2024 · 0 comments

Comments

@HerrMedizins
Copy link

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()
@HerrMedizins HerrMedizins closed this as not planned Won't fix, can't repro, duplicate, stale May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant