Skip to content

Error in examples/display_text_simpletest.py #95

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
lastcoolnameleft opened this issue Nov 6, 2020 · 4 comments
Closed

Error in examples/display_text_simpletest.py #95

lastcoolnameleft opened this issue Nov 6, 2020 · 4 comments

Comments

@lastcoolnameleft
Copy link

lastcoolnameleft commented Nov 6, 2020

I have the recent Adabox016 (Adafruit Matrix Portal) and when I try to use the simpletest.py, I get:

Traceback (most recent call last):
  File "code.py", line 10, in <module>
AttributeError: 'module' object has no attribute 'DISPLAY'

I'm using the library from adafruit-circuitpython-bundle-6.x-mpy-20201030

@lastcoolnameleft
Copy link
Author

I'm experiencing this issue with adafruit-circuitpython-matrixportal_m4-en_US-6.0.0-rc.1.uf2

@FoamyGuy
Copy link
Contributor

FoamyGuy commented Nov 6, 2020

The example code is assuming that it will get run on a device that has a display built in (in which case it would be available as board.DISPLAY within the code).

But the Matrix Portal needs to do a bit of setup first before it can start using the display.

There is a MatrixPortal library which will do lots of the set up for you. If you use that the simpletest example code can be adapted to work on the Matrix portal like this:

import terminalio
from adafruit_display_text import label
from adafruit_matrixportal.matrix import Matrix
matrix = Matrix()
display = matrix.display

text = "Hello\nworld"
text_area = label.Label(terminalio.FONT, text=text)
text_area.x = 1
text_area.y = 4
display.show(text_area)
while True:
    pass

@FoamyGuy
Copy link
Contributor

FoamyGuy commented Nov 6, 2020

@lastcoolnameleft This example has been added in the examples directory now: https://github.com/adafruit/Adafruit_CircuitPython_Display_Text/blob/master/examples/display_text_matrixportal.py

I'm going to close this issue for now. But if you end up having trouble when you try this feel free to ping me here or in the discord I can help you out.

@FoamyGuy FoamyGuy closed this as completed Nov 6, 2020
@lastcoolnameleft
Copy link
Author

Thanks for the update and clarification about how/when to use it. The documentation just pointed me to the repo so I was unaware that the code was for a specific board. I'm good with it being closed.

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

No branches or pull requests

2 participants