I'm using python3 with ncurses (curses) inside a docker container.
The problem is that mouse events are not accurately reporting x
position in terminals that have more than 222
cells width. At first glance this is an obvious limitation because as far as i can see the position is sent in a single byte.
However Midnight Commander accurately handles large terminals. After some digging i could not find how to properly handle mouse with curses (this example does not work properly). Everything i tried with curses failed to work with large terminals. It seems that midnight commander is using gpm
, but i could not find any way to use that in python.
q1: How can i handle mouse in large terminals in python3 directly, preferably with curses?
q2: Taking midnight commander as an example, will printing the escape sequences directly in stdout
make the mouse work as expected ?
q3: Is there any other terminal gui library that handles mouse properly for python ?
It's not a direct limitation of the python interface to curses, but rather a feature of the underlying curses library, terminal description and the terminal: