[zeromq-dev] GTK event loop integration, anybody?

Michael Haberler mail17 at mah.priv.at
Fri Feb 8 19:10:43 CET 2013


Steven,

Am 08.02.2013 um 18:39 schrieb Steven McCoy:

> On 8 February 2013 12:31, Michael Haberler <mail17 at mah.priv.at> wrote:
> I'm looking to into integrating zmq with a pyGTK (eventually pygobject) application, including event loop integration
> 
> any pointers to a working example?
> 
> You can wrap around zmq_poll.

sorry, 'wrap around' was a tad above my pay grade ;)

I see the following options:

1. poll from the idle loop (g_idle_add() or py equivalent) 
2. poll in a glib timer event (g_timeout_add() or python equivalent)
3. use zmq_getsockopt/ZMQ_FD to retrieve the file descriptor associated with the socket and have the gtk main loop issue a callback on FD events
4. use the pyzmq gevent route 
5. somehow have separate event loops (not sure if this is possible)

3) I'd feel confortable with rolling myself
5) ? dunno.

4) uses the dreaded libevent under the gevent Python package, so I'd rather not use that
1+2: not my style ;)

is 3) reasonable? if not, what else?


thanks for the help.

- Michael


> One has to raise a concern about the integration, one would prefer a separate UI thread to the business logic and thus separate event loops:  Gtk for the UI and zmq_poll for the data.
> 
> -- 
> Steve-o
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev




More information about the zeromq-dev mailing list