revisions per limor
MODIFY
PyPortal_ObliqueStrategies/oblique.py
PyPortal_ObliqueStrategies/oblique.py
@@ -9,8 +9,7 @@ import board
from strategies import strategies
from adafruit_pyportal import PyPortal
-cwd = os.getcwd() # the current working directory (where this file is)
-wrap = 35 # text wrap value
+cwd = ("/"+__file__).rsplit('/', 1)[0] # the current working directory (where this file is)
# create pyportal object w no data source (we'll feed it text later)
pyportal = PyPortal(url = None,
@@ -18,10 +17,8 @@ pyportal = PyPortal(url = None,
status_neopixel = board.NEOPIXEL,
default_bg = None,
text_font = cwd+"fonts/Arial-ItalicMT-17.bdf",
- text_position = (30, 100),
+ text_position = (30, 120),
text_color = 0xFFFFFF,
- text_wrap = wrap,
- text_maxlen = 180, # max text size for quote & author
)
pyportal.set_text("loading ...") # display while user waits
@@ -31,14 +28,11 @@ pyportal.set_text("OBLIQUE STRATEGIES\nBrian Eno / Peter Schmidt") # show title
while True:
if pyportal.touchscreen.touch_point:
# get random string from array and wrap
- index = random.randint(0, len(strategies)-1)
- strat = pyportal.wrap_nicely(strategies[index], wrap)
+ strat = pyportal.wrap_nicely(random.choice(strategies), 35)
# convert wrap array into line breaks
- outstring = ""
- for s in strat:
- outstring += s + "\n"
- # load new text
+ outstring = '\n'.join(strat)
+ # display new text
pyportal.set_text(outstring, 0)
- # don't repeat until a new touch is detected
+ # don't repeat until a new touch begins
while pyportal.touchscreen.touch_point:
continue

revisions per limor