目前,如果我将 TERM 环境变量设置为“xterm-1003”,我可以获得鼠标移动事件,但我会得到糟糕的颜色和 curses.can_change_color() == False
os.environ['TERM'] = 'xterm-1003'
...
curses.mousemask(curses.ALL_MOUSE_EVENTS | curses.REPORT_MOUSE_POSITION)
...
while True:
event = screen.getch()
if event == curses.KEY_MOUSE:
# I get nice events whenever I move the mouse (no click required)
_, mx, my, _, _ = curses.getmouse()
如果我将 TERM env var 设置为“xterm-256color”,我会得到一个不错的调色板加上 curses.can_change_color() == True,但是除非我单击按钮,否则我不会收到鼠标事件!
>ls /usr/share/terminfo/x/
报告
xfce xterm-256color xterm-hp xterm-r5 xterm-xf86-v32 xterm-xfree86
xterm xterm-88color xterm-new xterm-r6 xterm-xf86-v33 xterm-xi
xterm-1002 xterm-8bit xterm-nic xterm-sco xterm-xf86-v333 xterms
xterm-1003 xterm-basic xterm-noapp xterm-sun xterm-xf86-v40
xterm-16color xterm-bold xterm-old xterm-vt220 xterm-xf86-v43
xterm-24 xterm-color xterm-pcolor xterm-vt52 xterm-xf86-v44
我尝试过的似乎都不支持 curses.can_change_color() == True 和鼠标移动事件。有没有办法通过设置适当的 $TERM 值或其他方式来获得它们?
谢谢!