0

I Want to schedule a Job to be done after every 5 seconds which takes around 3 seconds to execute. I have used

kivy.uix.clock.Clock.schedule_interval(my_job, 5)

and

def my_Job():
   # Job Statements
   time.sleep(5)
   my_job()
my_thread = threading.Thread(target=my_Job)
my_thread.start()

so far. But first one block's my design as it get executed in main Thread and second one reach

RecursionError: maximum recursion depth exceeded while calling a Python object

in a long run. I am stuck here, Is there anyone to help me ? Thanks

Note: I am using kivy to develop a desktop app.

user3666197
  • 1
  • 6
  • 50
  • 92
Ahmad Raza
  • 1,923
  • 2
  • 14
  • 19

1 Answers1

2

You can use sched. See the documentation. Note that you should not to anything that changes the kivy GUI in my_job() when run this way. But you can call Clock.schedule_once() from my_job to do just the GUI stuff.

John Anderson
  • 35,991
  • 4
  • 13
  • 36