Curses sorely lacking an event loop?

Discussion in 'Python' started by James Stroud, Feb 27, 2007.

  1. James Stroud

    James Stroud Guest

    Hello,

    Is curses really lacking an event loop? Do I have to write my own? I
    infer from the docs that this is the case. For example, I want the
    screen to be updated with resize but I find myself waiting for getch()
    if I want user input, and so the screen must remain ugly until the user
    presses a key. What am I missing?

    Also, does anyone have boilerplate for handling mouse events? getmouse()
    returns an "ERR" of no particular description and also appears to
    require a preceding getch() and hence does not seem to be wired at all
    for clicks, although allusion to clicks is found in the descriptions for
    mouseinterval() and mousemask().

    Here is the error message for getmouse() in case anyone wants details:
    "_curses.error: getmouse() returned ERR". This is much less informative
    than one might hope.

    Thanks in advance for any help.

    James
     
    James Stroud, Feb 27, 2007
    #1
    1. Advertisements

  2. I'm not a curses expert, but I can answer this part. When the screen
    is resized, SIGWINCH is sent to the process. You can use the normal
    signal handling apparatus to install a handler that updates the screen
    when that signal arrives.


    Mike
     
    Michael Zawrotny, Feb 27, 2007
    #2
    1. Advertisements

  3. Did you check Urwid? http://excess.org/urwid

    Michele Simionato
     
    Michele Simionato, Feb 27, 2007
    #3
  4. James Stroud

    James Stroud Guest

    Thank you. This is good to know.

    James
     
    James Stroud, Feb 28, 2007
    #4
  5. James Stroud

    James Stroud Guest

    Perfect. Just what I was looking for.

    Thank you.

    James
     
    James Stroud, Feb 28, 2007
    #5
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.