Skip to content

Latest commit

 

History

25 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vtclear

vtclear banner

Python ANSI VT100 implementation of Erase Screen

CI PyPI version Python versions License: MIT DeepWiki

installation

uv add vtclear

or

pip install vtclear

usage

from vtclear import clear_screen
clear_screen()

The escape sequence itself is exported too, in case you want to write it somewhere other than stdout:

import sys
from vtclear import CLEAR_SCREEN
sys.stderr.write(CLEAR_SCREEN)
sys.stderr.flush()  # no newline in the sequence, so flush by hand

notes

Any VT100 compatible terminal reads the sequence, Windows Terminal included: it has been the default host on Windows 11 since 22H2. The exception is the classic console host, conhost.exe, still the default on Windows 10, where virtual terminal processing stays off unless something turns it on and CPython does not. There the sequence is printed verbatim instead of clearing, and enabling it is the caller's job, e.g. through colorama.just_fix_windows_console().

license

This project is licensed under the MIT License.

About

ANSI screen clearing and cursor positioning for Python.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages