1

Background:

This is really an architecture question.

I'm looking to port an application currently written in LabView to Python. It is a hardware control and measurement application which basically orchestrates a bunch of heterogeneous hardware to run tests.

I'm considering basing the Python application on Pykka, since an actor abstraction seems particularly suitable for orchestrating a bunch of parallel hardware tasks (the LabView app uses the LV Actor Framework).

The application needs a GUI -- PyQt and PyQtGraph are extremely promising here.

Problem

Pykka and PyQt are built around event loops and have different ideas about threading and inter-thread communication. I'm uncertain how I could structure code to let a Pykka actor display an interface using PyQt. I've played with modifying the Pykka event loop to call PyQt's processEvents(), with subclassing pykka.Actor such that it's implemented with QProcess, and with having a Pykka actor hold a reference to a standalone thread. I haven't been able to come up with a satisfying result, and it's because I'm somewhat new to both libraries.

How can I build a Pykka actor that displays and manages a PyQt GUI?

(p.s. Answers of "You're Crazy" are welcomed!)

Tobin
  • 133
  • 1
  • 7
  • 1
    While I haven't done anything with Pykka, I have done stuff controlling heterogenous hardware (see [labscript suite](http://labscriptsuite.org)). Our approach was to put the hardware interface code into separate Python processes (spawned by the GUI) and communicate with them using ZMQ sockets. So one solution could be to have the PyQt and Pykka event loops running in separate processes and just pass messages between them over a socket of some kind. – three_pineapples Jan 16 '15 at 01:16
  • Hey, thank you for the comment - and thanks for pointing me to your labscript suite, it looks extremely interesting. I've got your paper, and will read it with interest! – Tobin Jan 16 '15 at 01:47
  • You're welcome! I doubt the suite itself will be useful for you, but hopefully the underlying design decisions will give you ideas for your program. – three_pineapples Jan 16 '15 at 02:06
  • I've also had a look at Pykka in a little more detail. I think you can probably have all of Pykka start from a Python thread, which leaves the PyQt event loop for the main thread. Have you seen anything that says you can't start the Pykka event loop from a Python thread? – three_pineapples Jan 16 '15 at 02:15

0 Answers0