Ask coding questions

← Back to all posts
Is there a way to make ascii animation less choppy in python?
Brendan23 (139)

Question

so if you run the "all aboard!" you can see that the cursor moves around and it is choppy. is there a way to change it?(don't say "don't use python")

Answered by Ganesha1 (39) [earned 5 cycles]
View Answer
Comments
hotnewtop
Ganesha1 (39)

Flush the screen constantly or get hacker or learn another lang.

Also, file reading does take a second so you may want to keep all the frames in one file and just load them into an array for easier access.

Brendan23 (139)

@Ganesha1 so I'll try the flush method.

Brendan23 (139)

@Ganesha1 welp. flush screen doesn't work. how do I "keep all the frames in one file and just load them into an array for easier access."?

Ganesha1 (39)

@Brendan23 put all the frames in one file then put seperators between them something like "=%!%="
then open the file with all the frames, read it and use .split("(your seperator)") then if you put all the frames in order they should be in an organized array.

frames = open("file_of_frames.txt", "r").read().split("=%!%=")
for frame in frames:
    print(frame)
Brendan23 (139)

@Brendan23 so just to be clear "file_of_frames.txt" is just a placeholder right? I put the file with all the files .txt instead right?

Ganesha1 (39)

@Brendan23 Yeah that's just a place holder, you can name the file & file extension whatever you want.

IcynDevz (765)

Do this:

import cursor
cursor.hide()

At the top of your code.

IcynDevz (765)

@Brendan23 if it worked, please mark my answer as the correct answer

Coder100 (17137)

idk what happens when someone gets an upvote @IcingHackz