Progress bar set doesn't work in loop #265
Replies: 2 comments 2 replies
-
@Azuremoon13 I am working on a project right now where I do exactly that. I put my loop in a new thread with the "threading" library in python and it works just fine :D Hope that makes sense :D |
Beta Was this translation helpful? Give feedback.
-
In tkinter there is the .after() method to do this, to avoid using separate threads, which can cause problems in tkinter: import customtkinter
class App(customtkinter.CTk):
def __init__(self):
super().__init__()
self.value = 0
self.progressbar = customtkinter.CTkProgressBar(self)
self.progressbar.pack(pady=20)
self.progressbar.set(self.value)
self.update_progressbar()
def update_progressbar(self):
self.value += 0.01
self.progressbar.set(self.value)
if self.value < 1:
self.after(20, self.update_progressbar) # call update_progressbar after 20 ms
app = App()
app.mainloop() |
Beta Was this translation helpful? Give feedback.
-
progressbar.set(value) doesnt work in a loop, only sets the last value in the list
Beta Was this translation helpful? Give feedback.
All reactions