I've written the following basic python curses application using Eclipse and PyDev.
#!/usr/bin/python
import curses
myscreen = curses.initscr()
curses.noecho()
curses.curs_set(0)
myscreen.keypad(1)
myscreen.border(0)
myscreen.addstr(12, 25, "Python Curses")
myscreen.refresh()
while True:
event = myscreen.getch()
if event == ord("q"): break
if event == ord("a"):
myscreen.addstr(12, 25, "You Pressed A")
myscreen.refresh()
if event == ord("b"):
myscreen.addstr(12, 25, "You Pressed B")
myscreen.refresh()
curses.endwin()
The program runs fine in the linux terminal but throws up an error when I try to run it in Eclipse PyDev "curses.curs_set(0) _curses.error: curs_set() returned ERR" If I remove that line I just end up with lots of dashes and it waits for input.
Is it possible to debug python curses code in eclipse or is their another IDE better suited for python curses development?
Also is curses the right thing to be using for interactive console applications? (I'm looking todo a lot more that just basic user input which can be done with readlines.)