curses and python (linux, debian)
David M. Cooke
cookedm+news at physics.mcmaster.ca
Mon May 3 15:57:46 EDT 2004
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)
--
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke
|cookedm(at)physics(dot)mcmaster(dot)ca
More information about the Python-list
mailing list