Skip to content

Using plain terminalio with displayio - ValueError: Tile index out of bounds #7885

Closed
@dorinclisu

Description

@dorinclisu

CircuitPython version

Adafruit CircuitPython 8.0.5 on 2023-03-31; Raspberry Pi Pico with rp2040

Code/REPL

import displayio
import board
import busio
import terminalio

from adafruit_st7735r import ST7735R


displayio.release_displays()
tft_spi = busio.SPI(clock=board.GP18, MOSI=board.GP19)
tft_cs = board.GP17
tft_dc = board.GP16
tft_reset = board.GP20

displayio.release_displays()
tft_bus = displayio.FourWire(tft_spi, command=tft_dc, chip_select=tft_cs, reset=tft_reset)
tft = ST7735R(tft_bus, width=128, height=128, colstart=2, rowstart=3)

background = displayio.Group()
tft.show(background)
bitmap = displayio.Bitmap(128, 128, 1)
palette = displayio.Palette(1)
palette[0] = 0x7f007f
sprite = displayio.TileGrid(bitmap, pixel_shader=palette, x=0, y=0)
background.append(sprite)

terminal = terminalio.Terminal(sprite, font=terminalio.FONT)
terminal.write('abc')  # this crashes

Behavior

Traceback (most recent call last):
  File "<stdin>", line 28, in <module>
ValueError: Tile index out of bounds

Description

I'm not sure if I'm using terminalio correctly, but I found no examples and this is all the documentation: https://docs.circuitpython.org/en/latest/shared-bindings/terminalio/index.html

I know there is an extra library adafruit_display_text (works with the exact same setup) but plain terminalio is also supposed to work which is why I think this is a bug.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions