Hello, I was trying to use Python bindings for the library and I’ve done the initial process of how to download it so first I went to /rpi-rgb-led-matrix and ran make -C examples-api-use
which went well with 0 errors. after that, I ran bindings for Python 3 in /bindings/python
sudo apt-get update && sudo apt-get install python3-dev python3-pillow -y
make build-python PYTHON=$(command -v python3)
sudo make install-python PYTHON=$(command -v python3)
No errors.
I ran samples with no problem at all although IntelliSense doesn’t work I suppose you don’t have that so I didn’t mind it but when I tried to use the library in my script outside the rpi-rgb-led-matrix
it sent out an error that module is not found.
((.venv) ) vitek@vitekrpi4:~/rpi-led-panel-editor/Python$ sudo python3 panelEditor.py
Traceback (most recent call last):
File "/home/vitek/rpi-led-panel-editor/Python/panelEditor.py", line 1, in <module>
from rgbmatrix import RGBMatrix, RGBMatrixOptions
ModuleNotFoundError: No module named 'rgbmatrix'
Code I wanted to execute outside rpi-rgb-led-matrix
:
from rgbmatrix import RGBMatrix, RGBMatrixOptions
class ledPanelEditor:
def __init__(self, hardware_mapping="regular", rows=64, cols=64, chain_lenght=2, parallel=2, row_address_type=0, multiplexing=1, pwm_bits=11, brightness=100, pwm_lsb_nanoseconds=130, led_rgb_sequence="RGB", led_pixel_mapper="", panel_type="", gpio_slowdown=4, disable_hardware_pulsing=False, drop_privileges=False):
options = RGBMatrixOptions()
options.hardware_mapping = hardware_mapping
options.rows = rows
options.cols = cols
options.chain_length = chain_lenght
options.parallel = parallel
options.row_address_type = row_address_type
options.multiplexing = multiplexing
options.pwm_bits = pwm_bits
options.brightness = brightness
options.pwm_lsb_nanoseconds = pwm_lsb_nanoseconds
options.led_rgb_sequence = led_rgb_sequence
options.pixel_mapper_config = led_pixel_mapper
options.panel_type = panel_type
options.gpio_slowdown = gpio_slowdown
options.disable_hardware_pulsing = disable_hardware_pulsing
options.drop_privileges = drop_privileges
self.matrix = RGBMatrix(options = options)
def rectangle(self, x, y):
offset_canvas = self.matrix.CreateFrameCanvas()
offset_canvas.SetPixel(x, y, 0, 0, 255)
offset_canvas = self.matrix.SwapOnVSync(offset_canvas)
panelEditor = ledPanelEditor()
panelEditor.rectangle(15, 15)
I have a Python virtual environment done
OS: Linux server programming with VScode SSH on Linux desktop VM
Hardware: Raspberry pi 4, 4 32x32 led panels and a shield for these panels
Wiring is ok
I was checking if I have the library inside the Python Venv and it is there
(I couldn’t send an embedded because I’m a new member)
Here is how the IntelliSense is acting up
I’m very new to git and make I might have just made a rookie mistake