S
S
shuzzixd2021-06-13 22:28:18
Python
shuzzixd, 2021-06-13 22:28:18

How to make animated text in Python?

I know how to make animated, but how to make it stop animating after the last line ('Test',)?

Code:
loading = [
'T',
'Te',
'Tes',
'Test',
]

while True:
for value in loading:
os.system('cls')
print(value)
time.sleep(0.1)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alan Gibizov, 2021-06-14
@shuzzixd

import os
import time
loading = 'Тест'

value = ''

for symbol in loading:
    os.system('cls')
    value = ''.join([value, symbol])
    print(value)
    time.sleep(0.1)

Option:
import os
import time
loading = 'Тест'

for i,_ in enumerate(loading):
    os.system('cls')
    print(loading[:i+1])
    time.sleep(0.1)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question