#用來練習curses如果在 text console下是正常的,但若是在 gnome-terminal
import time, curses
def draw(line,col):
try:
stdscr.addch(line,col,"H")
stdscr.refresh()
time.sleep(0.02)
except curses.error: pass
while True:
stdscr = curses.initscr()
winH,winW=stdscr.getmaxyx()
stdscr.bkgd('.')
for Y in range (0,winH/2):
for col in range (Y,winW-Y):
draw(Y,col)
for line in range (Y+1,winH-Y):
draw(line,winW-(Y+1))
for col in range (winW-(Y+1),Y-1,-1):
draw(winH-(Y+1),col)
for line in range (winH-(Y+1),Y,-1):
draw(line,Y)
stdscr.clear()
curses.endwin()
卻會在左下角出現一個"." 而不是"H" !?
沒有留言:
張貼留言