step by step guide for running those Python terminal effect scripts in Termux. I’ll cover file creation, running, making executable, installing extras, and common tips.
1) Install prerequisites
Open Termux and run:
pkg update -y && pkg upgrade -y
pkg install python -y # provides `python`
pkg install nano -y # or use vim if you prefer
pkg install cmatrix -y # optional: ready-made Matrix
2) Create the script file
Option A — use nano (interactive):
nano starfield.py
# paste the Python code
# Save: Ctrl+X → Y → Enter
Option B — use a heredoc to create quickly:
cat > starfield.py <<'PY'
# paste the whole script here
import random, time, os, sys
cols, rows = os.get_terminal_size()
# ...
PY
(Replace starfield.py and the block with whichever script: snowfall.py, typer.py, bounce.py.)
3) Run the script
Run with:
python starfield.py
If your script is compatible with python3 only (rare in Termux), use python3.
To make it directly executable (optional):
chmod +x starfield.py
./starfield.py
(Only works if the file has a shebang #!/usr/bin/env python on the first line. If not, just run python script.py.)
4) Stop the script
Press CTRL + C in Termux to exit any running script.
5) If terminal size errors occur
If you get errors about os.get_terminal_size() on some Termux setups, open Termux settings → change font/rows, or replace the call in script with:
import shutil
cols, rows = shutil.get_terminal_size()
Then save and run again.
6) Install optional Python packages (colors, audio)
If a script needs colorama or other packages:
pip install --user colorama
(You can drop --user if pip installs globally in Termux.)
Audio libraries (pyaudio) are harder on Termux — ask me if you want help attempting that.
7) Run cmatrix (easy Matrix)
If you prefer the packaged Matrix:
pkg install cmatrix -y # if not already installed
cmatrix
Exit with CTRL + C.
8) Helpful tips
- If the output scrolls off-screen, make sure your terminal has enough rows (swipe to resize or use volume keys depending on Termux UI).
- To run multiple effects at once, open a new Termux session (long-press app icon → split or start new session), or use
tmux(pkg install tmux) to keep sessions organized. - To combine effects, you can run a script in one session and
python typer.pyin another.