kivy.clock vs threading of python

38 Views Asked by At

I am currently developing an Android app using Kivy and have a requirement to execute certain functions in a separate thread. I understand that Python threads are typically employed for parallel task execution. Additionally, I've come across Kivy's clock.schedule_once(function, t) method, which I believe can run a function in another thread after a specified time 't'. This leads me to wonder if both Python threads and Kivy Clock can be used interchangeably to run functions in threads other than the main one. If this is the case, could you please clarify the specific scenarios in which each approach is more suitable?

Is it possible to utilize kivy.clock.schedule_once for adding a widget from a Python thread, as an alternative to using @mainthread?

For both cases (Python threads and Kivy Clock), I aim to add or modify a widget, understanding that UI-related operations should be performed in the main thread. Can you provide guidance on how to achieve this in both scenarios, perhaps with an illustrative example?

I have independently researched Python threads and Kivy's clock.schedule_once. I would greatly appreciate your assistance in clarifying the questions I've raised.

0

There are 0 best solutions below