So far I have learned how to use window.move (y, x) and window.clrtoeol () to clear the contents on a specific line or from any starting point to the end of this line.
I am developing a game similar to Tetris, but the “block” falls, causes a collision, then a certain area will be cleared, depending on the length of the block. Therefore, I need to know how to delete rows in a specific range of coordinates. For instance:
import curses
stdscr = curses.initscr()
for y in range(9,20):
for x in range(9,20):
stdscr.addstr(y,x,'#')
stdscr.refresh()
the above code makes a square with the string '#'.
How can I clear the beginning of the contents of (10,10) and end with (10,20)?
source
share