Electron-Python | WIN10 Electron+Python界面开发(通信方式:thrift) | Runtime Evironment library
kandi X-RAY | Electron-Python Summary
kandi X-RAY | Electron-Python Summary
WIN10 Electron+Python界面开发(通信方式:thrift)
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- test the first thing
- Generate hello message .
Electron-Python Key Features
Electron-Python Examples and Code Snippets
Community Discussions
Trending Discussions on Electron-Python
QUESTION
I am developing an electron-python app and I need to install zerorpc
to share data between nodejs and python.
I first installed zeromq
to the system
ANSWER
Answered 2020-Oct-25 at 22:43Zerorpc
is outdated and last update was 2 years ago. I suppose it's incompatible with NodeJs 15. Try it with nodejs 10, 12, or 14 versions.
QUESTION
I try to build a GUI for given Python code using Electron. The data flow is actually straight-forward: The user interacts with the Electron app, which sends a request to the Python API, which processes the request and sends a reply.
So far, so good. I read different threads and blog posts:
- ZeroRPC solutions:
- https://medium.com/@abulka/electron-python-4e8c807bfa5e
- https://github.com/fyears/electron-python-example
- Spawn Python API as child process from node.js and communicate directly:
- https://www.ahmedbouchefra.com/connect-python-3-electron-nodejs-build-desktop-apps/
- This seems to be not the smartest solution for me, since using zeroRPC or zeroMQ makes it more easy to change the frontend architecture without touching the backend code.
- Use zeroMQ sockets (for example exclusive pair?)
But in all three solutions, I struggle at the same point: I have to make asynchronous requests/replies, because the request processing can take some time and in this time, there can occur already further requests. For me, this looks like a very common pattern, but I found nothing on SO, maybe I just don't know, what exactly I am looking for.
...ANSWER
Answered 2020-Jun-07 at 20:16If you're thinking of using ZeroMQ, you are entering into the world of Actor model programming. In actor model programming, sending a message happens independently of receiving that message (the two activities are asynchronous).
What ZeroMQ means by Blocking
When ZeroMQ talks about a send "blocking", what that means is that the internal buffer ZeroMQ uses to queue up messages prior to transmission is full, so it blocks the sending application until there is space available in this queue. The thing that empties the queue is the successful transfer of earlier messages to the receiver, which has a receive buffer, which has to be emptied by the recieve application. The thing that actually transfers the messages is the mamangement thread(s) that belong to the ZeroMQ contenxt.
This management thread is the cruicial part; it's running independently of your own application threads, and so it's making the communications between sender and receiver asynchronous.
What you likely want is to use ZeroMQ's reactor, zmq_poll(). Typically in actor model programming you have a loop, and at the top is a call to the reactor (zmq_poll() in this case). Zmq_poll() tells you when something has happened, but here you'd primarily be interested in it telling you that a message has arrived. Typically then you'd read that message, process it (which may involve sending out other ZeroMQ messages), and looping back to the zmq_poll().
Backend
So your backend would be something like:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Electron-Python
You can use Electron-Python like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page