Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
python3诅咒pad中的addstr,但在迭代循环中未显示_Python_Python 3.x_Curses - Fatal编程技术网

python3诅咒pad中的addstr,但在迭代循环中未显示

python3诅咒pad中的addstr,但在迭代循环中未显示,python,python-3.x,curses,Python,Python 3.x,Curses,使用以下内容创建: 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.getm

使用以下内容创建:

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>]
问题函数:

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>]
输出:

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>]
[['main','µIRC',]]
调试:使用/连接[:]
问题:

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”进行“刷新”

python的curses绑定似乎没有区分pad和windows。如果那是C,如果那真的是一个诅咒pad,那么您将在stdscr的
刷新之前使用
pnoutrefresh
。但这是类似的。简单的

        i[2].wnoutrefresh()

        self.stdscr.addstr('debug: %s\n' % message)
这可能是我们的初衷