CustomTkinter
CustomTkinter copied to clipboard
wait_variable() causes entire program to halt
Creating an IntVar and waiting for it using wait_variable on the CTk object pauses the entire program regardless
without "self.window.wait_variable(wait_variable)" allows the program to flow as usual, however adding it prevents the entire program from running
When the button is pressed it calls a lambda function which sets the value of "wait_variable" to 1
I don't know but i hope this will work.
If you normally starting a def function, the programm will wait until the function is finished.
Also the window.mainloop() function stops until the def function is finished.
There are some ways to fix it:
For example use _thread.start_new_thread()
It allows you to run functions and the main program at the same time.
Example:
import _thread
[...]
_thread.start_new_thread(load_login_window, ())
Can you provide a full example? I never used wait_variable and I don't know why this would be useful or how this should work.
If i understand correctly, the entire window pauses if a process is occurring?
An easy fix for that is to use Threading pip install pythread
An example of using threading:
def convert():
#Converts and downloads a YouTube video
thread = pythread.createThread("nameOfThread", convert, delay)
Now you can call thread.start() with a button click or something...
It works by splitting the actual app and the function into two processes.