def print_random_chars(scr, lock, n, tx, ty, sx, sy, sw, sh):
lock.acquire()
try:
for i in range(0, n):
x = randint(1, tx-2)
y = randint(1, ty-2)
if (x > sx and x < (sx + sw) )\
and (y > sy and y < (sy + sh)):
continue
color = randint(100, 199)
c = '%x' % randint(0, 15)
if randint(0,100) % 2 == 0:
c = ' '
scr.addstr(y, x, c, color_pair(color))
scr.refresh()
finally:
lock.release()
评论列表
文章目录