Skip to content

Instantly share code, notes, and snippets.

@rhwlo
Created July 2, 2015 23:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rhwlo/c79e935cdbcea0e67506 to your computer and use it in GitHub Desktop.
Save rhwlo/c79e935cdbcea0e67506 to your computer and use it in GitHub Desktop.
an animated skull in curses! idea from Achewood
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import curses
import time
SKULLS = ("""
▒▒▒▒▒▒▒
▒▒▓▓▓▓▓▓▓▓▓▓▓▒▒
▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒
▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒
▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒
▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒
▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒
▒▓▓▓▓▓▓░ ░▓▓▓░ ░▓▓▓▓▓▓▒
░▓▓▓▓░ ▒▓▒ ▓▓▓▓░
▓▓▓▒ ▒▓▒ ▒▓▓▓
▓▓▓▒ ▒▓▓▓▒ ▒▓▓▓
░▓▓▓▓▒▒▓▓▓ ▓▓▓▒▒▓▓▓▓░
░▓▓▓▓▓▓▓░ ░▓▓▓▓▓▓▓░
▒▓▓▓▓▓▓▓▒▓▓▓▓▓▓▓▒
▒▓░▓░▓░▓░▓░▓░▓▒
▒▒▒ ▓▓▒▓ ▓ ▓ ▓ ▓▒▓▓ ▒▒▒
▒▓▓▓▓ ▓▓▓▓▓▒▓▒▓▒▓▓▓ ▒▓▓▓▓
▓▓▓▓▓▒▒ ░▓▓▓▓▓▓▓▓▓░ ▒▒▓▓▓▓▓▓
▒▓▓▓▓▓▓▓▓▓▓▓▒▒ ░░░░░ ▒▒▒▒▓▓▓▓▓▓▓▓▓▓
▓▓▓▓░░░▓▓▓▓▓▓▓▓▓▓▒▒▒ ▒▒▓▓▓▓▓▓▓▓▓░░░▓▓▓░
▒▒▒ ░░▓▓▓▓▓▓▓▓▓▓▓▒▒ ░░▓░░░
▒▒▒▒ ░░▓▓▓▓▓▓▓▓▓▓▒▒▒
▒▓▓▓▒▒▒▓▓▓▓▓▓▓▓▓▒▒ ░░▓▓▓▓▓▓▓▓▓▓▓▒▒▒▓▓▓
▓▓▓▓▓▓▓▓▓▓░░░░ ░░▓▓▓▓▓▓▓▓▓▓▓░
░▓▓▓▓▓░ ░░▓▓▓▓░░
▓▓▓░ ▓▓▓▓░
""", """
▒▒▒▒▒▒▒
▒▒▓▓▓▓▓▓▓▓▓▓▓▒▒
▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒
▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒
▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒
▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒
▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒
▒▓▓▓▓▓▓░ ░▓▓▓░ ░▓▓▓▓▓▓▒
░▓▓▓▓░ ▒▓▒ ▓▓▓▓░
▓▓▓▒ ▒▓▒ ▒▓▓▓
▓▓▓▒ ▒▓▓▓▒ ▒▓▓▓
░▓▓▓▓▒▒▓▓▓ ▓▓▓▒▒▓▓▓▓░
░▓▓▓▓▓▓▓░ ░▓▓▓▓▓▓▓░
▒▓▓▓▓▓▓▓▒▓▓▓▓▓▓▓▒
▒▓░▓░▓░▓░▓░▓░▓▒
▒▒▒ ▓▓▒▓ ▓ ▓ ▓ ▓▒▓▓ ▒▒▒
▒▓▓▓▓ ▓▓▓▓▓▒▓▒▓▒▓▓▓ ▒▓▓▓▓
▓▓▓▓▓▒▒ ░▓▓▓▓▓▓▓▓▓░ ▒▒▓▓▓▓▓▓
▒▓▓▓▓▓▓▓▓▓▓▓▒▒ ░░░░░ ▒▒▒▒▓▓▓▓▓▓▓▓▓▓
▓▓▓▓░░░▓▓▓▓▓▓▓▓▓▓▒▒▒ ▒▒▓▓▓▓▓▓▓▓▓░░░▓▓▓░
▒▒▒ ░░▓▓▓▓▓▓▓▓▓▓▓▒▒ ░░▓░░░
▒▒▒▒ ░░▓▓▓▓▓▓▓▓▓▓▒▒▒
▒▓▓▓▒▒▒▓▓▓▓▓▓▓▓▓▒▒ ░░▓▓▓▓▓▓▓▓▓▓▓▒▒▒▓▓▓
▓▓▓▓▓▓▓▓▓▓░░░░ ░░▓▓▓▓▓▓▓▓▓▓▓░
░▓▓▓▓▓░ ░░▓▓▓▓░░
▓▓▓░ ▓▓▓▓░
HA
""")
def tick(stdscr, onoff):
stdscr.clear()
selection = SKULLS[1] if onoff else SKULLS[0]
for (y, line) in enumerate(selection.split('\n')):
stdscr.addstr(curses.LINES // 2 - 15 + y, curses.COLS // 2 - 20, line)
stdscr.addch(curses.LINES - 2, curses.COLS - 2, ' ')
stdscr.refresh()
return not onoff
def main(stdscr):
onoff = False
while True:
onoff = tick(stdscr, onoff)
time.sleep(1.0)
curses.wrapper(main)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment