[python3诅咒padstr在迭代循环中未显示

问题描述 投票:4回答:1

使用以下内容创建:

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。

python python-3.x curses
1个回答
0
投票

未对“键盘”进行“刷新”

        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绑定不能区分垫和窗口。如果那是C,并且确实是一个诅咒pad,则在stdscrpnoutrefresh之前使用refresh。但是wnoutrefresh是类似的。一个简单的

        i[2].wnoutrefresh()

之前

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

可能是预期的。

© www.soinside.com 2019 - 2024. All rights reserved.