curses : unexpected behaviour with pad

Discussion in 'Python' started by Riccardo Galli, Sep 6, 2004.

  1. 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
     
    Riccardo Galli, Sep 6, 2004
    #1
    1. Advertising

  2. Riccardo Galli

    dody Guest

    > def main_1(stdscr):
    > win=curses.newwin(0,0)
    > pad=win.subpad(100,100) #<--- error


    I found that the behaviour of curses silently considers
    subpad of a WINDOW object as also a WINDOW instead of PAD,
    whether you uses subpad or subwin. try:

    win=curses.newpad(0,0)
    pad=win.subpad(100,100)

    > def main_2(stscr):
    > pad = curses.newpad(100, 100)
    > a_panel= panel.new_panel(pad) #<--- error


    Panel does not support PAD. you must use WINDOW. this should
    works:

    pad = curses.newwin(100, 100)
    a_panel= panel.new_panel(pad)

    --
    Best regards,
    dody mailto:
     
    dody, Sep 25, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark MacRae
    Replies:
    1
    Views:
    2,546
    John Timney \(Microsoft MVP\)
    Aug 7, 2003
  2. Charles A. Lackman

    Javascript Scribble Pad

    Charles A. Lackman, Nov 9, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    1,031
    Kevin Spencer
    Nov 9, 2004
  3. Jean-Paul Calderone
    Replies:
    2
    Views:
    467
    Joel Hedlund
    Feb 9, 2006
  4. PerlFAQ Server
    Replies:
    0
    Views:
    216
    PerlFAQ Server
    Feb 5, 2011
  5. PerlFAQ Server
    Replies:
    0
    Views:
    191
    PerlFAQ Server
    Mar 13, 2011
Loading...

Share This Page