gpt4 book ai didi

python3 curses addstr in pad 未显示在迭代循环中

转载 作者:行者123 更新时间:2023-12-01 06:28:49 26 4
gpt4 key购买 nike

使用这些创建:

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。

最佳答案

没有为“垫”做“刷新”

        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绑定(bind)不区分pad和windows。如果那是 C,如果那真的是诅咒 ,您将使用 pnoutrefreshrefresh 之前为 stdscr。但是 wnoutrefresh是类似的。一个简单的
        i[2].wnoutrefresh()

之前
        self.stdscr.addstr('debug: %s\n' % message)

可能是预期的。

关于python3 curses addstr in pad 未显示在迭代循环中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25186407/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com