|
hace 1 año | |
---|---|---|
.. | ||
images | hace 1 año | |
README.md | hace 1 año | |
main.py | hace 1 año | |
requirements.txt | hace 1 año | |
zmq-server.py | hace 1 año |
This example is a basic Zeromq implementation with NiceGUI. It shows how to stream data from a ZeroMQ socket to a NiceGUI plot.
In order to do this, the zmq Python library is used to create a publisher and a subscriber. The main interesting aspect is that the zmq.async library is used to create a subscriber that can be used in an asyncio loop, which is necessary to run the NiceGUI server.
There are two components to this example: the publisher and the NiceGUI server.
In addition to the normal NiceGUI dependencies, the zmq library must be installed (see requirements.txt).
The publisher is a simple Python script that sends random data to a ZeroMQ socket. To run it, simply execute the following command:
python zmq-server.py
The NiceGUI server is a Python script that creates a plot and updates it with data from the ZeroMQ socket. To run it, execute the following command:
python main.py
Once both the publisher and GUI server are running, you will see an updating plot on the UI.