-
Couldn't load subscription status.
- Fork 86
Description
First off, thank you for the fantastic Gem, it's been a lifesaver for a project I've been working on (and your notes in the README about PyGILState_Ensure and PyGILState_Release helped me make it work in a Threaded scenario I have!).
I have a question about callbacks to Ruby code from the Python side.
Specifically from my main Ruby program I am calling some Python code that runs indefinitely, and then when events happen on the Python side I want to trigger some other Ruby code to run.
Unfortunately it's not trivial to setup an example (which also prevents running the Ruby code as a subprocess or something on the Python side), but the best way to describe it I can think of is this:
- Start a Ruby program
- Call a Python program that draws a GUI via PyCall
- User Clicks on a button in the GUI
- The Click triggers a block of Ruby code to run
The only thing I can think of right now is either constantly polling the Python side for some state in a Thread on the Ruby side (not my favorite), or setting up something like ZeroMQ and have the Python side push messages that are consumed on the Ruby side when the interaction occurs, but before I go down that path I wanted to make sure I wasn't missing something easy regarding PyCall callbacks.