The suggested answer is more complicated than necessary. Rather than use newwin, if you use subwin, it shares memory with the original window, and will be repainted without additional work.
Here is the original program modified to do that (a one-line change):
import curses
screen = curses.initscr()
try:
screen.border(0)
box1 = screen.subwin(20, 20, 5, 5)
box1.box()
screen.getch()
finally:
curses.endwin()
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…