Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gobject.MainLoop and tornado.IOLoop at once?

How can you run two event loops in one application?

I need to use tornado.IOLoop (WebSocket client) and gobject.MainLoop (pygtk) in one Python program.

Update: Threadless solutions are preferred.

like image 684
guettli Avatar asked Oct 21 '22 20:10

guettli


2 Answers

You can try my gioloop.py. This is a IOLoop implementation with gobject.io_add_watch, so it's a single-threaded solution.

like image 147
schlamar Avatar answered Oct 23 '22 09:10

schlamar


You could use a thread

import threading
threading.Thread(target=my_ioloop.start).start()
like image 32
Remco Haszing Avatar answered Oct 23 '22 10:10

Remco Haszing