Comments (2)
@FoamyGuy I have retested this, with the new refactor. This is working as expected. There is A mistake in my test code. I test this in the pyportal and in the Pygame Display without any problems
The problem was in the setter as I was not using the =
sign. If you coudl retest it and verify that everything is working
import terminalio
import displayio
from os import uname
import time
if uname()[0] == 'samd51':
import board
else:
from blinka_displayio_pygamedisplay import PyGameDisplay
from adafruit_display_text import label, bitmap_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/Helvetica-Bold-16.bdf")
LINE_HOR = displayio.Bitmap(4, 320, 2)
LINE_VER = displayio.Bitmap(320, 4, 2)
palette = displayio.Palette(2)
palette[0] = 0x004400
palette[1] = 0x00FFFF
text = "CircuitPython"
text_area = bitmap_label.Label(MEDIUM_FONT,
text="First Text",
label_direction="LTR",
background_tight=True,
x=200,
y=100,
padding_left=10,
padding_top=10,
padding_bottom=10,
padding_right=10,
)
text_area.anchored_position=(200, 100)
text_area.anchor_point=(0.5, 0.5)
splash.append(text_area)
text_area_UPR = bitmap_label.Label(MEDIUM_FONT, text=text,
# label_direction="UPR",
x=10,
y=10,)
splash.append(text_area_UPR)
text_area_DWR = bitmap_label.Label(MEDIUM_FONT,
text="Upwards",
label_direction="UPR",
# x=200,
# y=200,
anchored_position=(200, 200),
anchor_point=(0.5, 1.0),
)
line_ver= displayio.TileGrid(LINE_VER,
pixel_shader=palette,
x=0,
y=200)
splash.append(line_ver)
line_hor= displayio.TileGrid(LINE_HOR,
pixel_shader=palette,
x=200,
y=0)
splash.append(line_hor)
splash.append(text_area_DWR)
display.show(splash)
while True:
pass
from adafruit_circuitpython_display_text.
I confirmed the anchor positioning is working as intended with the given script and a modified simpletest.
Thanks for looking into this as well @jposada202020
from adafruit_circuitpython_display_text.
Related Issues (20)
- Spaces are deleted when word-wrapping HOT 1
- Updates to text are inefficient for special case of same length and width text HOT 3
- bitmap_label losing direction HOT 6
- Suppress warnings in bitmap_label HOT 1
- Use `fontio.FontProtocol` for type annotations
- Label can take Tuple[int, int, int] for color HOT 1
- wrap_text_to_pixels() cannot handle Windows line endings HOT 1
- bitmap_label flicker HOT 1
- Unable to update scrolling_label text outside constructor HOT 2
- Exception with multiple consecutive newlines in bitmap label
- label.Label padding is wrong when using DWR or UPR HOT 5
- button simpletest throws error on PyPortal Titano HOT 2
- bitmap_label errors if no bitmaptools module present
- ValueError from negatives on first character
- Convert `.show()` to `.root_group =` for CircuitPython 9
- Program stops without any error when importing the library HOT 4
- bitmap label cuts off part of text HOT 3
- Add error handling for misspelled kwargs in adafruit_display_text.label HOT 4
- Feature Request: wrap_text_to_pixels truncate argument
- Property `background_tight` not working for `bitmap_label.Label`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from adafruit_circuitpython_display_text.