Scroll PHAT: How to scroll a text only once?


#1

Hi there,

do you might have a Python code example which displays/scrolls a provided text string only once?

The current examples are using an endless scroll loop.

Many thanks in advance,

Alexander


#2

The example uses a While loop. Either call the function outside, or use a ridiculously high value for time.sleep?


#3

seems my earlier answer couldn’t have been any less helpful if I’d try ;-)

I think the answer can be as complicated as you’d like.

You could use a ‘for i in range()’ conditional but that would be dependent on the string you want to scroll. Could be a valid option if you have full control of the text input.

Failing that analysing the user input and passing a value to the range function relative to its length might be possible without too much hassle.

… being completely inept with Python though I would suspect there is a more elegant answer than either of those.