Have you ever tried updating the console with text that changes multiple times a second? Remember how when you tried clearing the console with os.system calls it would make the console flash and make the text unreadable? I wrote this python module to prevent exactly that. Introducing…

ConsoleDraw

A python module to update the console without flashing.

Supported Operating Systems

The consoledraw module should be supported on Windows, Linux and Mac (although it has not been tested on Mac).

Installation

The consoledraw module can be installed using pip.

pip install consoledraw

Demo

demo.py:

from math import sin
from time import sleep

import consoledraw

console = consoledraw.Console()

x = 0
while True:
    with console:    
        for i in range(23):
            console.print("    |" + " " * round(abs(sin((x + i) * 0.05)) * 9.5) + "O") # Prints to the custom console's buffer (works the same as python's built-in print)
    
    x += 1

    sleep(1/60) 

Demo GIF

with console:    
    console.print("Hello, world!")
    console.print("Another message!")

# is the same as

console.clear()

console.print("Hello, world!")
console.print("Another message!")

console.update()

GitHub

View Github