Skip to content

Instantly share code, notes, and snippets.

@derpston
Created April 11, 2012 17:56
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save derpston/2360946 to your computer and use it in GitHub Desktop.
Save derpston/2360946 to your computer and use it in GitHub Desktop.
Python curses example
# Scatters dots randomly on your terminal as a quick demo of curses.
import curses
import random
import time
window = curses.initscr()
try:
(h, w) = window.getmaxyx()
while True:
x = int(random.random() * w)
y = int(random.random() * h)
window.move(y, x)
window.addch("*")
window.refresh()
time.sleep(0.05)
except KeyboardInterrupt:
pass
finally:
curses.endwin()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment