Created
October 13, 2019 20:50
-
-
Save clebio/01a6d893ad613f41f852e2ce3de11f9e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from time import time, sleep | |
import curses | |
from curses import wrapper | |
from curses.textpad import Textbox, rectangle | |
from math import sin, cos | |
def main(stdscr): | |
dx0, dy0, dwidth, dheight = int(curses.COLS/2)-15, int(curses.LINES/2)-3, 30, 5 | |
displaywin = curses.newwin(dheight, dwidth, dy0, dx0) | |
disptext = displaywin.derwin(dheight-2, dwidth-2, 1, 1) | |
displaywin.erase() | |
disptext.erase() | |
while True: | |
i, j = int(10 * sin(time())), int(10 * cos(time())) | |
cx, cy = dx0 + i, dy0 + j | |
stdscr.erase() | |
stdscr.noutrefresh() | |
displaywin.erase() | |
disptext.erase() | |
disptext.addstr(0, 0, f"{cy}, {cx}") | |
displaywin.mvwin(cy, cx) | |
disptext.mvwin(cy+1, cx+1) | |
displaywin.border() | |
displaywin.noutrefresh() | |
disptext.noutrefresh() | |
curses.doupdate() | |
sleep(0.1) | |
wrapper(main) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment