Mon 29 September 2025

Scroll Art Python Package

Posted by Al Sweigart in misc   

Scroll art is moving ASCII art produced by stdout text printed from a loop, animated as the text scrolls up the terminal. It's especially useful as creating computing projects for beginner programmers. Because it only uses text, no environment setup or additional libraries are needed and scroll art can be made in every programming language. I've published examples of scroll art on https://scrollart.org, but now I've also included Python implementations in the scrollart package, which you can install by running pip install scrollart and view with python -m scrollart --help.

Here are the scroll art pieces available in the 0.2.0 version of the package:

starfield         - Animated starfield with pulsing density of stars
stripeout         - Alternating fill/empty effect with block or random patterns
twists            - Vertical columns that twist around each other
tsuro             - Infinite maze-like patterns using interconnected tiles
pipe_swap         - Vertical pipes that occasionally swap positions
skybursts         - Random firework-like bursts radiating from points
forth_and_back    - Block that bounces back and forth with acceleration
moire             - Overlapping circles with sine wave creating moire patterns
skulls_and_hearts - Hearts floating over a background of skull patterns
pac_wall          - Vertical columns of alternating characters and spaces
inchworm          - Animated worm that stretches and bunches as it moves
connected_pipes   - Network of connected pipes using box-drawing characters
diagonal_sweep    - Diagonal sweep pattern that alternates between on and off
earthworm_tunnels - Worms digging tunnels through dirt that grows back
towers_and_towers - Animated tower construction with overlapping structures
any_size_diagonal_maze - Diagonal maze pattern with random forward and back slashes
thorns             - Random length thorn lines centered on screen
triangle_hall      - Animated strut points creating triangular patterns
vertical_struts    - Vertical struts with horizontal crossbeams at random positions
hex_portals        - Hexagonal portals with optional interior patterns
toggler1           - Moving togglers that flip characters between two states
toggler2           - Paired togglers creating triangular wave patterns
tri_grid_scaffold  - Triangular grid scaffolding with varying density
orbital_travels    - Multiple characters orbiting in sine wave patterns
snail_trail        - Animated snails leaving trails as they crawl across
password_cracker   - Matrix-style password cracking animation
dna                - Animated DNA double helix structure
spike              - Growing and shrinking spike pattern using terminal width
zigzag             - Simple zig zag animation that bounces left and right
diamond_sky        - Falling diamonds of various sizes with random patterns
ducklings          - Screensaver of many adorable ducklings
full_of_squares    - Falling squares using Unicode box-drawing characters
in_and_out         - Travelers moving in and out from screen edges with dynamic capacity
matrix             - Matrix-style digital rain with falling streams of characters
sine_message       - Message that oscillates horizontally using sine wave motion
proton_stream      - Multiple streams that move while maintaining distance constraints
striped_triangles  - Animated triangular patterns with changing density
math_func          - Mathematical visualization using Unicode block characters
cube_wall          - Wall of 3D cubes with random shading patterns
bundfc             - Architectural waves inspired by Shanghai's Bund Financial Center

For example, running python -m scrollart starfield will run the Starfield demo. You can view the code in the package's scrollart.starfield() function. Each function has several parameters that you can adjust, and by default the width adjusts itself to the width of the Terminal window. The functions run forever until you press Ctrl-C to quit. Each function also has a max_rows parameter, if you want to produce a finite amount to pipe or copy/paste to a text file.


Check out other books by Al Sweigart, free online or available for purchase:

...and other books as well! Or register for the online video course. You can also donate to or support the author directly.