rm-hull / luma.lcd

Python module to drive PCD8544, HT1621, ST7735, ST7567 and UC1701X-based LCDs
https://luma-lcd.readthedocs.io
MIT License
156 stars 56 forks source link

Unexpected Keyword Argument Error #75

Closed LouisPi closed 5 years ago

LouisPi commented 5 years ago

Here is my code:

from luma.core.interface.serial import spi
from luma.core.render import canvas
from luma.lcd.device import st7735

serial = spi(height=128, width=128, h_offset=1, v_offset=2, bgr=True)
device = st7735(serial)

with canvas(device) as draw:
        draw.rectangle(device.bounding_box, outline="white", fill="black")
        draw.text((30,40), "Hello World", fill="red")

and here is my error message:

Traceback (most recent call last):
  File "gui.py", line 5, in <module>
    serial = spi(height=128, width=128, h_offset=1, v_offset=2, bgr=True)
TypeError: __init__() got an unexpected keyword argument 'width'

Any idea what I am doing wrong? The unexpected keyword argument is different each time and I can run the examples fine.

thijstriemstra commented 5 years ago

you're instantiating spi incorrectly, there's not a width param: https://github.com/rm-hull/luma.core/blob/master/luma/core/interface/serial.py#L250

See https://luma-lcd.readthedocs.io/en/latest/python-usage.html