I'm trying to get all of my script's output to be on a single line, but the output won't always be the same length, so before I print the next line I "wipe" it by printing a line of white space.
Sometimes the output flickers now due to the white space overwriting it. What's the best way to buffer the output and then write it all at once?
while(True):
print(' ' * width, end='\r')
print(f'Mouse position: {mouse.position}', end='\r', flush=True)
time.sleep(.05)