curses and python (linux, debian)

Guido no.email at please.invalid
Tue May 4 13:22:08 EDT 2004


David M. Cooke wrote:

> At some point, Guido <no.email at please.invalid> wrote:
> 
> 
>>Hello
>>
>>I'm new to python and i'm trying to write a script that shows a menu.
>>
>>Now, I have some troubles with curses.setsyx()
>>
>>I do:
>>
>>import curses
>>
>>curses.setsyx(2, 20)
>>curses.putp("TEST TITLE")
>>curses.setsyx(25, 35)
>>curses.putp("TEST CENTER")
>>curses.setsyx(12, 35)
>>curses.putp("TEST CENTER")
>>
>>but it just prints all the string after each other at the first
>>lines..
> 
> 
> Er, that's really the wrong way to do it. For one thing, curses.putp
> doesn't do what you think you want it to do. Have a look at "Curses
> Programming with Python":
> http://www.amk.ca/python/howto/curses/
> 
> Something like this:
> 
> import curses
> 
> def main(stdscr):
>     stdscr.addstr(2, 20, "TEST TITLE")
>     stdscr.addstr(25,35, "TEST CENTER")
>     stdscr.addstr(12,35, "TEST CENTER")
>     while 1:
>         c = stdscr.getch()
>         if c == ord('q'):
>            return
> 
> curses.wrapper(main)
> 

thx very much

very handy tutorial!

Now, i'm using DrPython, it looks fine, but i 
can't debug my curses program

It gives an error with this message: 
curses.wrapper returned ERR on curses.cbreak

if i run it with python, it works!

anybody?



More information about the Python-list mailing list