Skip to content

When using background setter, background text does not show correctly #136

Closed
@jposada202020

Description

@jposada202020

When ussing the setter for background text, the text does not show correctly. I am assuming that this applies for anchor point setter, as I was receiving complains from the code that I was testing. However I thought it was my new PR. Did not test this for anchor_point.

So sorry for not to catching this before the Refactor, but normally I do all the test with list iterations. sorry @FoamyGuy .

Test Code

import terminalio
import displayio
from os import uname
if uname()[0] == 'samd51':
    import board
else:
    from blinka_displayio_pygamedisplay import PyGameDisplay
from adafruit_display_text import label
from adafruit_bitmap_font import bitmap_font

if uname()[0] == 'samd51':
    display= board.DISPLAY
else:
    display = PyGameDisplay(width=320, height=240)
splash = displayio.Group(max_size=10)
MEDIUM_FONT = bitmap_font.load_font("fonts/LibreBodoniv2002-Bold-10.bdf")



bitmap = displayio.Bitmap(4, 320, 2)
palette = displayio.Palette(2)
palette[0] = 0x004400
palette[1] = 0x00FFFF
tile_grid = displayio.TileGrid(bitmap,
                               pixel_shader=palette,
                               x=155,
                               y=0)
splash.append(tile_grid)

bitmap = displayio.Bitmap(320, 4, 2)
tile_grid = displayio.TileGrid(bitmap,
                               pixel_shader=palette,
                               x=0,
                               y=110)
splash.append(tile_grid)


text = "CircuitPython"
text_area = label.Label(MEDIUM_FONT,
                        text=text,
                        x=155,
                        y=155,
                        padding_left=10,
                        padding_top=10,
                        padding_bottom=10,
                        background_color = 0x990099,
                        padding_right=10)

splash.append(text_area)

text = "CircuitPython"
text_area = label.Label(MEDIUM_FONT,
                        text=text,
                        background_tight=True,
                        padding_left=10,
                        padding_top=10,
                        padding_bottom=10,
                        padding_right=10)
text_area.x = 155
text_area.y = 110
text_area.background_color = 0x990099
splash.append(text_area)


display.show(splash)

Results

image

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