Created
March 24, 2022 21:46
-
-
Save aasmpro/e621ba058c4e2d3b61cf6661e873bfec to your computer and use it in GitHub Desktop.
Scrolling text, just like the ones you see in train stations :)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from time import sleep | |
def scrolling_text(text, screen_size, wait): | |
text = f"{' '*screen_size}{text}{' '*screen_size}" | |
while True: | |
for i in range(len(text) - screen_size): | |
print('\r', text[i:screen_size+i], end='', sep='', flush=True) | |
sleep(wait) | |
def main(): | |
text = input("text = ") | |
screen_size = int(input("screen size = ")) | |
wait = float(input("wait = ")) | |
scrolling_text(text, screen_size, wait) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment