kramer65
kramer65

Reputation: 53853

How to integrate zeromq polling into pyqt main loop?

I've got a simple PySide program (my first GUI program) in which I just have two sliders going from -100 to 100. The first slider sends its value to a hardware controller using zeromq. This controller drives a hardware steering wheel, but since the steering wheel takes some time to adjust its position to the desired position, I receive feedback from that wheel which I now want to reflect into the second slider below it. In this way, the second slider "follows" the first one to show how far the steering wheel actually is:

enter image description here

Since I both receive and send zeromq messages more or less simultaneously I need to do something with zeromq polling. I worked with that before, but not in a pyqt program. So I am kinda lost on where or how to incorporate the zeromq polling in this program.

The code I have right now is here: http://pastebin.com/8j5TDpkX

Would anybody have some kind of tip or hint on where to incorporate the zmq polling in there?

Upvotes: 2

Views: 1774

Answers (1)

djc
djc

Reputation: 11711

The old-fashioned way is to use the ZMQ_FD option to zmq_getsockopt(3) to get an edge-triggered file descriptor that can then be used in other kinds of event loops.

Upvotes: 1

Related Questions