Giter VIP home page Giter VIP logo

Comments (3)

FoamyGuy avatar FoamyGuy commented on September 22, 2024 1

I'm going to close this one. We can re-open if you anyone wants to revisit the x,y positioning specifically.

from adafruit_circuitpython_display_text.

FoamyGuy avatar FoamyGuy commented on September 22, 2024

I'm not sure when specifically that this behavior got changed, but I am leaning toward thinking the current behavior is more correct to be honest.

This code only sets the y position once in this line text.y = board.DISPLAY.height // 2 which is setting the y position to midway down the screen vertically.

Since this code is not using Anchored position I don't think any automatic centering (in any orientation) should be taking place really. It should be staying in the same location based on x,y positioning based on the default x/y origin.

In the older version of the library the y position appears to keep changing even though the user code is not making any more changes to it, which I think can be confusion to users.

from adafruit_circuitpython_display_text.

FoamyGuy avatar FoamyGuy commented on September 22, 2024

I modified your code to use anchored position and this way it behaves more like it did in the older version of the library even when I switch back to the new one:

import displayio
import terminalio
import board
import time
from adafruit_display_text.label import Label
text = Label(terminalio.FONT, text="line 1", max_glyphs=200)
board.DISPLAY.show(text)
#text.y = board.DISPLAY.height // 2

text.anchor_point = (0, 0.5)
text.anchored_position = (4, board.DISPLAY.height // 2)
for lines in range(2, 13 + 1):
    text.text = "\n".join(["Line " + str(line) for line in range(1, lines + 1)])
    time.sleep(2)

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.