Skip to content

The row height of the text is hard-coded #3

Closed
@lesamouraipourpre

Description

@lesamouraipourpre

If using a font which is taller than terminalio.FONT the rows overlap because an assumed height is hard-coded.
A variant of the simpletext with a bigger font

"""Display the microcontroller CPU temperature in C and F on a display."""
import microcontroller
from adafruit_simple_text_display import SimpleTextDisplay

from adafruit_bitmap_font import bitmap_font
FONT = bitmap_font.load_font("/fonts/LibreBodoniv2002-Bold-27.bdf")  # A bigger font

temperature_data = SimpleTextDisplay(title="Temperature Data!", title_scale=2, font=FONT)

while True:
    temperature_data[0].text = "Temperature: {:.2f} degrees C".format(
        microcontroller.cpu.temperature
    )
    temperature_data[1].text = "Temperature: {:.2f} degrees F".format(
        (microcontroller.cpu.temperature * (9 / 5) + 32)
    )
    temperature_data.show()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions