Q:

Mouse support with ncurses (for python) for large terminals

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 ?

A:

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:

For ncurses, that's the extended mouse feature which is standard in ncurses with ABI 6 (available since 2005, standard in ncurses 6 in 2015), noting that some distributions still provide ABI 5.
The terminal description has to use a feature which ncurses recognizes as implying the support for SGR 1006, and of course
The terminal itself has to support that feature (see note in ncurses database from January 2018 pointing out a few of the xterm imitators which do not).

