curses troubles

Lee Harr missive at frontiernet.net
Thu Sep 26 18:27:48 EDT 2002


> I'm trying to take user entered data input and store it as a var.
> 
> inside an __init__ I have curses set up a window, and display some 
> options. Then I use:
> while 1:
>     self.k = self.stdscr.ch()
>     if self.k == ord('G'): do_this()
>     elif self.k == ord('P'): do_another()
>     elif self.k == ord('Q'): break
> 
> Now, when running this, if I hit either G or P, the applications 
closes as if I'd hit Q
> 


Hi;

I made a pretty large application which uses curses.

The trouble is that it can be tough to debug, since all the screen
output is going through curses.

What i ended up doing is creating a log function which i can
call with various strings and variables and which writes its
output to a file... then on another terminal I can just tail
that file to see what is going on.

So what i would do is create such a function, then log the
value of self.k in that loop so you can see exactly what
is going on.




More information about the Python-list mailing list