+ self.fps = 30
+ GObject.timeout_add(50, self.mainloop)
+
+ def on_destroy(self, event):
+ self.running = False
+
+ def tick(self):
+ self.update()
+ self.queue_draw()
+
+ def mainloop(self):
+ self.running = True
+ while self.running:
+ time.sleep(1.0 / self.fps)
+ self.tick()
+ while Gtk.events_pending():
+ Gtk.main_iteration()
+
+ return False