Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jposada202020 opened this issue Mar 10, 2021 · 2 comments · Fixed by #137
Closed

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

jposada202020 opened this issue Mar 10, 2021 · 2 comments · Fixed by #137

Comments

@jposada202020
Copy link
Contributor

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

@jposada202020 jposada202020 changed the title When using backgroung setter, background text does not shows correctly When using backgroung setter, background text does not show correctly Mar 10, 2021
@jposada202020 jposada202020 changed the title When using backgroung setter, background text does not show correctly When using background setter, background text does not show correctly Mar 10, 2021
@jposada202020
Copy link
Contributor Author

I have tested in Release 2.15.0 and works as expected, using the same code included

@FoamyGuy
Copy link
Contributor

Good catch, I am glad you found this! I think this is the same issue from #49. I must have messed up the handling of background bitmap in refactoring. I will look into this tonight and get a fix in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants