Jubiluleu
Jubiluleu

Reputation: 61

Is there any mode to update a kivy window individually?

I have a kivy window, and I need to rotate a repeating loop"While" in code, but as expected, "While" stops the automatic update of the window, and as a result, locking it. For example:

--- "loop window" ---


var = 0
while var <= 100:
     var += 1
     print(var)


--- "end of loop" ---

The problem is that the program has to wait for the loop to finish, and this is locking in the window. I know that in Tkinter has a function Youroot.update(), which updates the window whenever called, I want to know if kivy also owns, or something similar. Please :)

Upvotes: 0

Views: 90

Answers (1)

John Anderson
John Anderson

Reputation: 38857

In Kivy, you should not run a loop like that on the main thread, so just run it on another thread (see threading). If you need to make a change to something in the kivy display from that thread, use Clock.schedule_once() to schedule just that bit back on the main thread.

Upvotes: 1

Related Questions