Skip to content

🧹✨ Clear your terminal in a fun way

License

Notifications You must be signed in to change notification settings

wenoptics/python-wipe-clean

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logo

Wipe Clean

Clear your terminal in a fun way. Works on most modern terminals. 0-dependency.

made-with-python PyPI - Python Version Maintainability

PyPI CI PyPI - Status PyPI - Downloads

Linux Mac OS Windows

Install • Usages • Advanced usages • Roadmap • Related projects

demo


Install

Install with pip:

pip install wipe-clean

wipe-clean currently requires Python 3.6.1 and above. Note that Python 3.6.0 is not supported due to lack of NamedTuples typing.

Usages

Just:

wipe-clean

Use -h, --help to show all available options

wipe-clean -h

Advanced usages

1. Use API

Click to expand

You can use wipe-clean inside your project.

from wipe_clean.main import cli as wc_cli

wc_cli()
# Or with arguments
wc_cli('--frame-interval=0.005', '--min-frame-delay=0')

2. Customization

It's possible to design your own brush shape and animation.

Example brush

Click to expand

To create a new brush type, implement the Brush interface, e.g.

from wipe_clean.brush import Brush, ScreenPointDrawing, ScreenPoint as P

class Wipe2x2(Brush):
    def get_points(self, x, y, angle) -> List[ScreenPointDrawing]:
        return [
            ScreenPointDrawing(P(x    , y    ), '#'),  # noqa: E202,E203
            ScreenPointDrawing(P(x + 1, y    ), '#'),  # noqa: E202,E203
            ScreenPointDrawing(P(x    , y + 1), '#'),  # noqa: E202,E203
            ScreenPointDrawing(P(x + 1, y + 1), '#'),
        ]

This will define a brush like this:

##
##

Example path

Click to expand

Similarly, you can implement the Path interface to create a new brush path.

import math
from wipe_clean.path import Path, PathPoint, ScreenPoint as P

class MySimplePath(Path):
    def get_points(self) -> Iterable[PathPoint]:
        return [
            PathPoint(P(10, 10), math.radians(45)),
            PathPoint(P(20,  5), math.radians(0)),
            PathPoint(P(40, 20), math.radians(90)),
        ]

Roadmap

See DEVELOPMENT.md

Related projects

  • JeanJouliaCode/wipeclean - JavaScript version

    The first brush type (BrushWipe) and path animations (PathZigZag, PathRectEdge) are direct ports of JeanJouliaCode/wipeclean. Credits go to JeanJouliaCode!

  • Textualize/rich - An inspiring textual UI library