I am replying to my own message due to the digest not appearing in my inbox yet today. I will add Alan Gould's responses and my reply to him manually.
alan.gauld at yahoo.co.uk wrote: > > Where can I find any documentation of the correct curses constant name(s) to > > use for detecting a "wheel down" action? Or do I just have to manually > > define my own BUTTON5 constant name for the wheel-down event? > > I suspect you need to look in the ncurses documentation or > even the C code. And that is no guarantee that the Python > curses module will expose any values you do find other > than as numeric codes. > > I would have expected the mouse wheel down/click to appear as > a BUTTON2 event to be honest. I didn't even realize there was > a BUTTON4 event defined let alone BUTTON5. > > Incidentally, when you talk about wheel up/down are you > talking about wheel rotation events rather than actual > button down/up events? In that case 4 and 5 might make sense. > > If you find the answer please post back, I'm very interested > since I'm in the middle of writing a book on the Python curses > module and was unaware of this behaviour. A whole new area > to explore.... I'm also interested in any documentation you > have already found on it - where did you get this understanding? Alan, Yes, when I talk about wheel up/down I do mean wheel rotation events, not wheel-button-down or up click events. The latter are correctly reported by the PDCurses implementation used by windows-curses V2.2.0 as BUTTON2 events. Christoph Gohlke gave me this link to the current-version PDCurses implementation definitions for the mouse state constants, which I found very helpful: https://github.com/wmcbrine/PDCurses/blob/master/curses.h#L199 The PDCurses names defined there are exactly what I needed to see, even if the current cpython and windows-curses implementations do not support them quite yet. I can safely define them myself and adjust my code as later releases of cpython and windows-curses are updated to support them natively. This link to an ncurses man page concerning mouse events is also instructive: https://invisible-island.net/ncurses/man/curs_mouse.3x.html On that page, he says: The ALL_MOUSE_EVENTS class does not include REPORT_MOUSE_POSITION. They are distinct. For example, in xterm, wheel/scrolling mice send position reports as a sequence of presses of buttons 4 or 5 without matching button-releases. With python 3.8.7 and windows-curses 2.2.0 I am seeing from my logging that the mouse wheel rotation up/down events are indeed reported by PDCurses (and presumably by ncurses on a *ix system) as BUTTON4_PRESSED and BUTTON5_PRESSED respectively, based on the constant values listed in the PDCurses link above. HTH Peter -- -- https://mail.python.org/mailman/listinfo/python-list