window.delch([y, x])
function can do what you want.
PS: I'm the questioner, and I found the answer myself.
Question
So far I've learnt how to use window.move(y, x) and window.clrtoeol() to clear content at a specific line or from any start point to the end of that line.
I'm designing a game similar to tetris, but the 'block' falls down will cause a collision, then the certain area will be cleared, depend on the block length. So I need to know how to remove strings in a specific coordinate range. For example:
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 make a square with string '#'. How could I clear the content start from (10,10) and end at(10,20)?
Solution
window.delch([y, x])
function can do what you want.
PS: I'm the questioner, and I found the answer myself.