Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import curses # probably won't run on MS Windows
- import time
- import string
- import random
- nlet = len (string.letters) # it's 52 i swear
- fieldx = 80
- fieldy = 23 # will crash if the terminal window is resized
- sleeptime = 0.04
- charrep = 11
- def randomch ():
- c = string.letters [random.randint(0, nlet - 1)]
- x = random.randint (0, fieldx - 1)
- y = random.randint (0, fieldy - 1)
- screen.addch (y, x, c)
- def decurse ():
- curses.echo ()
- curses.endwin ()
- # --- BEGIN ---
- screen = curses.initscr ()
- curses.noecho ()
- curses.curs_set (0)
- try:
- while True:
- for j in range (1, charrep):
- randomch ()
- screen.refresh ()
- time.sleep (sleeptime)
- except KeyboardInterrupt:
- pass
- finally:
- decurse ()
- print "^C"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement