curses : unexpected behaviour with pad

Riccardo Galli riccardo_cut-me at cut.me.sideralis.net
Sun Sep 5 19:44:33 EDT 2004


Hi,
I'm writing some widgets in curses.
Actually I'm trying to write a combobox. To do so, I need to create a pad
inside a panel, so that I can hide/show it.

I can't do it.

I can create a normal pad, but if I try to create it using "subpad" from a
window I get
_curses_panel.error: curses function returned NULL
, if the pad is greater than the window. But aren't pad supposed to be
greater than windows ?

If I create a pad and I try to attach it to a panel, with
panel.new_panel(pad)
I get again
_curses_panel.error: curses function returned NULL

I need to have a pad to show/hide.
Am I doing something wrong ?

Here comes what I do

########
import curses
from curses import panel

def main(stdscr):
    pad = curses.newpad(100, 100)
    pad.bkgd('x',0)
    pad.refresh( 0,0, 5,5, 15,15)
    pad.getch()

def main_1(stdscr):
    win=curses.newwin(0,0)
    pad=win.subpad(100,100)         #<--- error
    my_pan=panel.new_panel(win)
    pad.bkgd('x',0)
    pad.refresh( 0,0, 5,5, 15,15)
    panel.update_panels()
    curses.doupdate()
    pad.getch()

def main_2(stscr):
    pad = curses.newpad(100, 100)
    a_panel= panel.new_panel(pad)   #<--- error
    pad.bkgd('x',0)
    pad.refresh( 0,0, 5,5, 15,15)
    
    panel.update_panels()
    curses.doupdate()
    pad.getch()
    
if __name__=='__main__':
    curses.wrapper(main)
    #curses.wrapper(main_1)
    #curses.wrapper(main_2)
########

Thank you,
Riccardo

-- 
-=Riccardo Galli=-
 _,e.
s~  ``
 ~@.   ideralis Programs
.   ol 
 `**~  http://www.sideralis.net



More information about the Python-list mailing list