Home:ALL Converter>python3 curses addstr in pad not shown in iteration loop

python3 curses addstr in pad not shown in iteration loop

Ask Time:2014-08-07T23:28:16         Author:user3918999

Json Formatter

Created with these:

self.pads = []
self.pads.append( [ server, channel, curses.newpad(height - 2, width) ] )

The problem function:

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

The output:

[['main', 'µIRC', <_curses.curses window object at 0x7f73ff5a6b70>]]
debug: use /connect <server address>[:<server port>]

The problem:

Pad addstr is not printing anything visible. I'm using python3.3.

Author:user3918999,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/25186407/python3-curses-addstr-in-pad-not-shown-in-iteration-loop