Python Animated ASCII Art Tutorial

preview_player
Показать описание
A great beginner's tutorial on how to add animated ASCII art to your Python programs.
Рекомендации по теме
Комментарии
Автор

import os, time
os.system('cls') # linus - 'clear'
filenames = ["example.txt", "example.txt"]


def animator(filenames, delay = 1, repeat = 10):
frames = []
for name in filenames:
with open (name, "r", encoding="utf8") as f:
frames.append(f.readlines())
for i in range(repeat):
for frame in frames:
print("".join(frame))
time.sleep(delay)
os.system('cls')

animator(filename, delay = 0.1, repeat = 5)


yall welcome

elbowed
Автор

is there a way to have cleaner transition between the frames? I'm having a flickering effect frames are changing (upward motion)

quill
Автор

Awesome tutorial. Only request: make a tutorial on how to add these animations to a terminal program. I mean running other terminal program in parallel while updating frames in the animation. A lot of terminal applications do support some kind or animation/splash loading screen. The bottom part of the screen is where the main program executes and in the upper part the animation shows up ( could also be opposite).

HardikGhoshal
Автор

hello, thanks for the video. Please what if we want to stop the animation when the user push a button?

fredtchiadeu
Автор

can't find any good animated ascii art!

Sam-qigw
Автор

what characters did you use for the Pac-Man? I'm totally down for creating my own, but I've never seen characters like that before.

migueln
Автор

is there a way I can do this on Mac or is it the same for everything beside the 'clear'

joem
Автор

got this shit to work111 LETS GOO!! need it for my project lol

MNMnick
Автор

Hello from Greece, I have a question. What is the size of the console? I remember that in DOS days we had 25 rows of 80 characters.

farmakoxeris
Автор

I don't know if this will get seen but I am wondering if this can be done without using files. I would like to send my game to friends but I don't know how to install files onto their computer and also I don't want to. If I could do this by alternating print statements with triple quotes that would be awesome.

davidn
Автор

Edit: Fixed it
Code doesn't work:
The code
import time
import os

filenames["1.txt", "2.txt"]
frames = []
for name in filenames:
with open(name, "r", encoding="utf8") as f:


for frame in frames:
print("".join(frame))
time.sleep(0.5)
os.system("cls")


maybe it's because my terminal app isn't very good and I'm using note pad to type it out

Pie-qgxw
Автор

I keep geting No such file or directory even though the file exists. ANYBODY PLASE HELP

dixienormus
Автор

how can i change the color of the text please ?

walter