You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a python curses project trying to detect mouse wheel movements, and I understand that mouse wheel events by convention are reported as BUTTON4 and BUTTON5 events.
I am running on a Win10 system with python 3.8.7 and windows-curses 2.2.0, which I am given to understand uses the gohlke PDCurses wheels for the underlying curses implementation.
I can display the values of all of the BUTTON1 to BUTTON4 event constants but python 3.8.7 barfs if I try to use any BUTTON5 event names. It also does not recognize the BUTTONn_RESERVED_EVENT names for buttons 1-4.
Any attempt to use a BUTTON5 constant name or BUTTONn_RESERVED_EVENT constant name fails:
Python 3.8.7 (tags/v3.8.7:6503f05, Dec 21 2020, 17:59:51) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import curses
>>> print("B5={:08x}".format(curses.BUTTON5_RELEASED))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'curses' has no attribute 'BUTTON5_RELEASED'
>>> print("B5={:08x}".format(curses.BUTTON1_RESERVED_EVENT))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'curses' has no attribute 'BUTTON1_RESERVED_EVENT'
When I actually capture mouse wheel events, the wheel-up event is reported as 0x00010000 or BUTTON4_PRESSED, but the wheel-down event is reported as 0x 00200000, which has no constant name associated with it for which I can find any documentation.
This is a logging trace if curses.get_wch() and curses.getkey() results and the curses.getmouse() results when KEY_MOUSE is returned. I have manually annotated the getmouse display lines indicating what mouse action I actually performed.
DEBUG:root:wch='539' = 0x021b at (0,0)
DEBUG:root:3ch='KEY_MOUSE at (0,0)'
DEBUG:root:3ch KEY_MOUSE detected at (0,0)
DEBUG:root:Mouse data id=0, x=60, y=31, z=0, bs=00000004 Button 1 click
DEBUG:root:wch='539' = 0x021b at (0,0)
DEBUG:root:3ch='KEY_MOUSE at (0,0)'
DEBUG:root:3ch KEY_MOUSE detected at (0,0)
DEBUG:root:Mouse data id=0, x=-1, y=-1, z=0, bs=00010000 wheel up once
DEBUG:root:wch='539' = 0x021b at (0,0)
DEBUG:root:3ch='KEY_MOUSE at (0,0)'
DEBUG:root:3ch KEY_MOUSE detected at (0,0)
DEBUG:root:Mouse data id=0, x=-1, y=-1, z=0, bs=00200000 wheel down once
DEBUG:root:wch='539' = 0x021b at (0,0)
DEBUG:root:3ch='KEY_MOUSE at (0,0)'
DEBUG:root:3ch KEY_MOUSE detected at (0,0)
DEBUG:root:Mouse data id=0, x=-1, y=-1, z=0, bs=00010000 wheel up once
DEBUG:root:wch='539' = 0x021b at (0,0)
DEBUG:root:3ch='KEY_MOUSE at (0,0)'
DEBUG:root:3ch KEY_MOUSE detected at (0,0)
DEBUG:root:Mouse data id=0, x=-1, y=-1, z=0, bs=00200000 wheel down once
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?
TIA for any help or RTFM you can provide.
Peter
The text was updated successfully, but these errors were encountered:
I have a python curses project trying to detect mouse wheel movements, and I understand that mouse wheel events by convention are reported as BUTTON4 and BUTTON5 events.
I am running on a Win10 system with python 3.8.7 and windows-curses 2.2.0, which I am given to understand uses the gohlke PDCurses wheels for the underlying curses implementation.
I can display the values of all of the BUTTON1 to BUTTON4 event constants but python 3.8.7 barfs if I try to use any BUTTON5 event names. It also does not recognize the BUTTONn_RESERVED_EVENT names for buttons 1-4.
yields this output:
Any attempt to use a BUTTON5 constant name or BUTTONn_RESERVED_EVENT constant name fails:
When I actually capture mouse wheel events, the wheel-up event is reported as 0x00010000 or BUTTON4_PRESSED, but the wheel-down event is reported as 0x 00200000, which has no constant name associated with it for which I can find any documentation.
This is a logging trace if curses.get_wch() and curses.getkey() results and the curses.getmouse() results when KEY_MOUSE is returned. I have manually annotated the getmouse display lines indicating what mouse action I actually performed.
DEBUG:root:wch='539' = 0x021b at (0,0)
DEBUG:root:3ch='KEY_MOUSE at (0,0)'
DEBUG:root:3ch KEY_MOUSE detected at (0,0)
DEBUG:root:Mouse data id=0, x=60, y=31, z=0, bs=00000004 Button 1 click
DEBUG:root:wch='539' = 0x021b at (0,0)
DEBUG:root:3ch='KEY_MOUSE at (0,0)'
DEBUG:root:3ch KEY_MOUSE detected at (0,0)
DEBUG:root:Mouse data id=0, x=-1, y=-1, z=0, bs=00010000 wheel up once
DEBUG:root:wch='539' = 0x021b at (0,0)
DEBUG:root:3ch='KEY_MOUSE at (0,0)'
DEBUG:root:3ch KEY_MOUSE detected at (0,0)
DEBUG:root:Mouse data id=0, x=-1, y=-1, z=0, bs=00200000 wheel down once
DEBUG:root:wch='539' = 0x021b at (0,0)
DEBUG:root:3ch='KEY_MOUSE at (0,0)'
DEBUG:root:3ch KEY_MOUSE detected at (0,0)
DEBUG:root:Mouse data id=0, x=-1, y=-1, z=0, bs=00010000 wheel up once
DEBUG:root:wch='539' = 0x021b at (0,0)
DEBUG:root:3ch='KEY_MOUSE at (0,0)'
DEBUG:root:3ch KEY_MOUSE detected at (0,0)
DEBUG:root:Mouse data id=0, x=-1, y=-1, z=0, bs=00200000 wheel down once
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?
TIA for any help or RTFM you can provide.
Peter
The text was updated successfully, but these errors were encountered: