1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
# pyliblo3
Welcome to the **pyliblo3** documentation!
**pyliblo3** is a cython wrapper for the C library [liblo](<https://liblo.sourceforge.net/>).
## Quick Introduction
```python
from pyliblo3 import *
import time
class MyServer(ServerThread):
def __init__(self, port=1234):
ServerThread.__init__(self, port)
@make_method('/foo', 'ifs')
def foo_callback(self, path, args):
i, f, s = args
print(f"Received message '{path}' with arguments: {i=}, {f=}, {s=}")
@make_method(None, None)
def fallback(self, path, args):
print(f"received unknown message '{path}' with {args=}")
server = MyServer()
server.start()
print(f"Server started in its own thread, send messages to {server.port}. Use CTRL-C to stop")
while True:
send(("127.0.0.0", server.port), "/foo", 10, 1.5, "bar")
send(("127.0.0.0", server.port), "/unknown", (3, 4))
time.sleep(1)
```
----
## Installation
```bash
pip install pyliblo3
```
|