Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import curses
- import time
- import random
- def main(stdscr):
- curses.use_default_colors()
- for i in range(0, curses.COLORS):
- curses.init_pair(i + 1, i, -1)
- stdscr.clear()
- while True:
- x = random.randint(1, curses.COLS - 2)
- y = random.randint(1, curses.LINES - 2)
- c = random.randint(1, curses.COLORS)
- stdscr.addch(y, x, '#', curses.color_pair(c))
- stdscr.refresh()
- time.sleep(0.1)
- curses = curses.wrapper(main)
- # To try this out, you will need to run it in a terminal that supports ANSI escape codes. Simply copy and paste the code into a file and run it with Python.
- # Let me know if you have any questions or if you'd like to see anything else in the comments.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement