curses mouse-events in linux console
janne halttunen
jhalttun at pp.htv.fi
Mon Apr 22 06:05:27 EDT 2002
Hello,
I'm on Mandrake Linux 8.2 with Python 2.2, and I have a problem of
mouse-events not emitting properly in curses when on console with gpm.
In X it works fine, the getch-method returning instantly on
mouse-clicks, but on console it doesn't return until after pressing key
on the keyboard.
The following script can be run to demonstrate the problem:
# curses mouse test: ESC to exit
import curses
def main(scr):
curses.mousemask(curses.ALL_MOUSE_EVENTS)
key=0
while key!=27:
key=scr.getch()
scr.erase()
if key==curses.KEY_MOUSE:
scr.addstr(0,0,str(curses.getmouse()))
else:
scr.addstr(0,0,str(key))
scr.refresh()
if __name__=='__main__':
curses.wrapper(main)
# END
Hope there is a solution to this.
janne
More information about the Python-list
mailing list