quotes display
This commit is contained in:
parent
5a918ff92a
commit
7727eae67a
3 changed files with 59291 additions and 0 deletions
59260
PyPortal_Quotes/fonts/Arial-ItalicMT-17.bdf
Normal file
59260
PyPortal_Quotes/fonts/Arial-ItalicMT-17.bdf
Normal file
File diff suppressed because it is too large
Load diff
31
PyPortal_Quotes/quote.py
Normal file
31
PyPortal_Quotes/quote.py
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import time
|
||||
import board
|
||||
from adafruit_pyportal import PyPortal
|
||||
|
||||
# Set up where we'll be fetching data from
|
||||
DATA_SOURCE = "https://www.adafruit.com/api/quotes.php"
|
||||
QUOTE_LOCATION = [0, 'text']
|
||||
AUTHOR_LOCATION = [0, 'author']
|
||||
|
||||
cwd = __file__.rsplit('/', 1)[0]
|
||||
pyportal = PyPortal(url=DATA_SOURCE,
|
||||
json_path=(QUOTE_LOCATION, AUTHOR_LOCATION),
|
||||
status_neopixel=board.NEOPIXEL,
|
||||
default_bg=cwd+"/quote_background.bmp",
|
||||
text_font=cwd+"/fonts/Arial-ItalicMT-17.bdf",
|
||||
text_position=((20, 40), # quote location
|
||||
(5, 190)), # author location
|
||||
text_color=(0xFFFFFF, # quote text color
|
||||
0x8080FF), # author text color
|
||||
text_wrap=(35, # characters to wrap for quote
|
||||
0), # no wrap for author
|
||||
text_maxlen=(180, 30), # max text size for quote & author
|
||||
)
|
||||
|
||||
while True:
|
||||
try:
|
||||
value = pyportal.fetch()
|
||||
print("Response is", value)
|
||||
except RuntimeError as e:
|
||||
print("Some error occured, retrying! -", e)
|
||||
time.sleep(60)
|
||||
BIN
PyPortal_Quotes/quote_background.bmp
Normal file
BIN
PyPortal_Quotes/quote_background.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 225 KiB |
Loading…
Reference in a new issue