[英]python3 curses addstr in pad not shown in iteration loop
用這些創建:
self.pads = []
self.pads.append( [ server, channel, curses.newpad(height - 2, width) ] )
問題函數:
def writepad(self, server, channel, message): # Write a line on-to pad, but do not switch pad_num (current pad)
(height, width) = self.stdscr.getmaxyx() # Conserve code.
self.stdscr.addstr('%s\n' % str(self.pads)) # debug
for i in self.pads:
if i.count(server) and i.count(channel):
i[2].addstr('%s\n' % message)
#i[2].refresh(1, 0, 0, 0, height - 2, width) # propably useless
self.stdscr.addstr('debug: %s\n' % message)
#self.stdscr.refresh() # propably useless
輸出:
[['main', 'µIRC', <_curses.curses window object at 0x7f73ff5a6b70>]]
debug: use /connect <server address>[:<server port>]
問題:
Pad addstr 沒有打印任何可見的東西。 我正在使用 python3.3。
沒有對“pad”進行“刷新”
i[2].addstr('%s\n' % message)
#i[2].refresh(1, 0, 0, 0, height - 2, width) # propably useless
self.stdscr.addstr('debug: %s\n' % message)
看來python的curses綁定不區分pads和windows。 如果那是 C,並且那真的是一個 curses pad ,那么您將在refresh
stdscr之前使用pnoutrefresh
。 但是wnoutrefresh是類似的。 一個簡單的
i[2].wnoutrefresh()
之前
self.stdscr.addstr('debug: %s\n' % message)
大概就是這個意思。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.