0

I need to have a custom timing for a component of my program (essentially i'm counting turns, at the rate of around 20 turns per second). Each turn i need to process some information.

However, I have to do this so that it could work with PyGTK. Any ideas on how to accomplish this?

Pwnna
  • 9,178
  • 21
  • 65
  • 91

1 Answers1

0

The simplest solution is to use glib.timeout_add, which can periodically run code in the GLib main thread.

If your calculation is time-consuming and needs to be run in a different thread, you can use Python's threading.Timer instead. When you're ready to update the GUI, use glib.idle_add.

Johannes Sasongko
  • 4,178
  • 23
  • 34