python curses constant names for mouse wheel movements?

Alan Gauld alan.gauld at yahoo.co.uk
Tue Mar 9 05:11:37 EST 2021


On 09/03/2021 01:05, pjfarley3 at earthlink.net wrote:
> 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.

> 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.

Thanks, I've done some tests and I see the events as

WHEEL FORWARD - 0x10000  or curses.BUTTON4_PRESSED
WHEEL BACK    - 0x200000   but not defined in the curses module

That's using ncurses on Linux.
Do you get the same mask value under PDcurses on Windows?

I suspect in the real world I'd probably create my own
definitions as WHEEL_FORWARD and WHEEL_BACKWARD just for
readability.

> This link to an ncurses man page concerning mouse events is also
> instructive:
> 
> https://invisible-island.net/ncurses/man/curs_mouse.3x.html

Thanks for that, I hadn't spotted that there was a mouse man
page before...

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Python-list mailing list