I know how to regularly call a function in a separate thread:
def main_loop():
cefpython.MessageLoopWork() # do something
threading.Timer(0.01, main_loop).start()
main_loop()
But how can I do it in the main thread (cefpython.MessageLoopWork()
must be called from the main thread).
In the cefpython example, it is done with wxTimer
, but I don't want to use wxpython
:
class MyApp(wx.App):
[...]
def CreateTimer(self):
self.timer = wx.Timer(self, self.timerID)
self.timer.Start(10) # 10ms
wx.EVT_TIMER(self, self.timerID, self.OnTimer)
def OnTimer(self, event):
cefpython.MessageLoopWork()