Is a Tweepy Stream listener asynchronous? I guess it probably is, and would try to run multiple versions of
scroll_tweet if several tweets come in at once.
You'll need a FIFO buffer which you dump tweets into instead of displaying them immediately, and then move your
scroll_tweet logic into a main loop which pops each Tweet off the buffer, one at a time, and scrolls it.
Edit: A FIFO buffer is just a fancy word for a
list which you append items to and them pop off the front, like so:
>>> x.append(1) # Add a tweet
>>> x.append(2) # Add another tweet
>>> x.pop(0) # Grab the first tweet in the queue
Adding/removing items from a Python list is inherently thread-safe as far as I know, so you don't have to worry about mutually exclusive locks or any complicated nonsense.
This means your program could try to add two items to the list simultaneously, and this would not result in any corruption or error.