GithubHelp home page GithubHelp logo

Comments (4)

kmatch98 avatar kmatch98 commented on June 16, 2024

Thanks for the detailed description of the issue!

As you suggested, it’s likely an issue with the anchored_position or maybe the bounding_box calculation of a blank string. I will check it out and get back with you.

from adafruit_circuitpython_display_text.

kmatch98 avatar kmatch98 commented on June 16, 2024

@CedarGroveStudios I tested using the latest version and it works ok for me. I think you are using a slightly older version of the label.

Can you please pull the latest adafruit_display_text\label library and let me know your results? Here is the circuitpython.org page with the latest library bundle.

Here's what I found:

  1. I used the 8/26 library bundle that you specified and it worked correctly for me. It worked both for label.mpy from the bundle and label.py from the latest library here.
  2. I went back to the 8/11 version of the library bundle and the results match what you showed above. Here is the older library version I used with the label.py file.

1. Results with the 8/26 library bundle - I think this is working right

Here is the output I get from running your code on the latest label.py library. I think this is the result that you should get.

adress: (12, 14)

TEST 0: pre-load Label text, change text later
x = 12 y= 14
x = 12 y= 14

TEST 1: no Label text, change text later
x = 12 y= 14
x = 12 y= 14

TEST 2: no Label text, no text in change
x = 12 y= 14
x = 12 y= 14

TEST 3: pre-load Label text, no text in change
x = 12 y= 14
x = 12 y= 14

2. Results with the 8/11 library bundle specified above - This matches the results you showed

adress: (12, 14)

TEST 0: pre-load Label text, change text later
x = 12 y= 14
x = 12 y= 14

TEST 1: no Label text, change text later
x = 12 y= 14
x = 12 y= 21

TEST 2: no Label text, no text in change
x = 12 y= 14
x = 12 y= 14

TEST 3: pre-load Label text, no text in change
x = 12 y= 14
x = 12 y= 7

The test code I used

Here is the code that I ran. The only change I made was import terminalio at the top:

import terminalio
from adafruit_display_text.label import Label

font_0 = terminalio.FONT  # Internal font

print('CircuitPython 5.x Library Bundle 20210-08-26')
address = (12, 14)
print('adress:', address)

print()
print('TEST 0: pre-load Label text, change text later')
test_0 = Label(font_0, text='0', color=0xFFFFFF, max_glyphs=1)
test_0.x, test_0.y = address
print('x =', test_0.x, 'y=', test_0.y)
test_0.text = '1'
print('x =', test_0.x, 'y=', test_0.y)

print()
print('TEST 1: no Label text, change text later')
test_1 = Label(font_0, text='', color=0xFFFFFF, max_glyphs=1)
test_1.x, test_1.y = address
print('x =', test_1.x, 'y=', test_1.y)
test_1.text = '1'
print('x =', test_1.x, 'y=', test_1.y)

print()
print('TEST 2: no Label text, no text in change')
test_2 = Label(font_0, text='', color=0xFFFFFF, max_glyphs=1)
test_2.x, test_2.y = address
print('x =', test_2.x, 'y=', test_2.y)
test_2.text = ''
print('x =', test_2.x, 'y=', test_2.y)

print()
print('TEST 3: pre-load Label text, no text in change')
test_3 = Label(font_0, text='0', color=0xFFFFFF, max_glyphs=1)
test_3.x, test_3.y = address
print('x =', test_3.x, 'y=', test_3.y)
test_3.text = ''
print('x =', test_3.x, 'y=', test_3.y)

while True:
    pass

from adafruit_circuitpython_display_text.

CedarGroveStudios avatar CedarGroveStudios commented on June 16, 2024

Thank you for your speedy response @kmatch98 ! I was able to confirm that 8/26 bundle release had indeed provided the fix. My always reliable automatic library update routine skipped over adafruit_display_text and a couple of other libraries during its latest execution. Sorry about the fire drill.

from adafruit_circuitpython_display_text.

kmatch98 avatar kmatch98 commented on June 16, 2024

No worries, I’m just glad we pre-emptively solved the issue. Cheers!

from adafruit_circuitpython_display_text.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.