7
7stud
I can't see to get any y, x coordinates to work with curses. Here is
an example:
import curses
def my_program(screen):
while True:
ch = screen.getch()
if ch == ord("q"):
break
if ch <= 255:
screen.addstr(30, 10, "*%s*" % chr(ch))
screen.refresh()
curses.wrapper(my_program)
Here is the result:
Traceback (most recent call last):
File "2pythontest.py", line 12, in ?
curses.wrapper(my_program)
File "/Library/Frameworks/Python.framework/Versions/2.4//lib/
python2.4/curses/wrapper.py", line 44, in wrapper
return func(stdscr, *args, **kwds)
File "2pythontest.py", line 9, in my_program
screen.addstr(30, 10, "*%s*" % chr(ch))
_curses.error: addstr() returned ERR
an example:
import curses
def my_program(screen):
while True:
ch = screen.getch()
if ch == ord("q"):
break
if ch <= 255:
screen.addstr(30, 10, "*%s*" % chr(ch))
screen.refresh()
curses.wrapper(my_program)
Here is the result:
Traceback (most recent call last):
File "2pythontest.py", line 12, in ?
curses.wrapper(my_program)
File "/Library/Frameworks/Python.framework/Versions/2.4//lib/
python2.4/curses/wrapper.py", line 44, in wrapper
return func(stdscr, *args, **kwds)
File "2pythontest.py", line 9, in my_program
screen.addstr(30, 10, "*%s*" % chr(ch))
_curses.error: addstr() returned ERR