Comments (7)
I am running pynput under linux and there definitively the support is missing.
from pynput.
from pynput.
I may be wrong in understanding the request. But I see that it is already supported.
I am running this on win 8.1
from pynput.
from pynput.
I have verified that it does not work under Linux---the keysyms are not recognised.
I have implemented most of the functionality. Missing is support for presenting different keys depending on the state of numlock; currently the arrow keys are always delivered to the listener, regardless of the numlock state.
from pynput.
I have pushed a fix which makes the numeric keypad work on Linux like it works on Windows. Please note that there is still not complete support; as on Windows, it is not possible to distinguish between key presses on the numeric keypad and ordinary numbers or arrow keys.
from pynput.
i dont know if i made it work or not...
it is very ugly but it is working on my linux mashine
class Key(enum.Enum):
alt = KeyCode._from_symbol('Alt_L')
...
...
scroll_lock = KeyCode._from_symbol('Scroll_Lock')
kp_0 = KeyCode(KEYPAD_KEYS['KP_0'])
kp_1 = KeyCode(KEYPAD_KEYS['KP_1'])
kp_2 = KeyCode(KEYPAD_KEYS['KP_2'])
kp_3 = KeyCode(KEYPAD_KEYS['KP_3'])
kp_4 = KeyCode(KEYPAD_KEYS['KP_4'])
kp_5 = KeyCode(KEYPAD_KEYS['KP_5'])
kp_6 = KeyCode(KEYPAD_KEYS['KP_6'])
kp_7 = KeyCode(KEYPAD_KEYS['KP_7'])
kp_8 = KeyCode(KEYPAD_KEYS['KP_8'])
kp_9 = KeyCode(KEYPAD_KEYS['KP_9'])
kp_add = KeyCode(KEYPAD_KEYS['KP_Add'])
kp_decimal = KeyCode(KEYPAD_KEYS['KP_Decimal'])
kp_delete = KeyCode(KEYPAD_KEYS['KP_Delete'])
kp_divide = KeyCode(KEYPAD_KEYS['KP_Divide'])
kp_down = KeyCode(KEYPAD_KEYS['KP_Down'])
kp_end = KeyCode(KEYPAD_KEYS['KP_End'])
kp_enter = KeyCode(KEYPAD_KEYS['KP_Enter'])
kp_equal = KeyCode(KEYPAD_KEYS['KP_Equal'])
kp_f1 = KeyCode(KEYPAD_KEYS['KP_F1'])
kp_f2 = KeyCode(KEYPAD_KEYS['KP_F2'])
kp_f3 = KeyCode(KEYPAD_KEYS['KP_F3'])
kp_f4 = KeyCode(KEYPAD_KEYS['KP_F4'])
kp_home = KeyCode(KEYPAD_KEYS['KP_Home'])
kp_insert = KeyCode(KEYPAD_KEYS['KP_Insert'])
kp_left = KeyCode(KEYPAD_KEYS['KP_Left'])
kp_multiply = KeyCode(KEYPAD_KEYS['KP_Multiply'])
kp_page_down = KeyCode(KEYPAD_KEYS['KP_Page_Down'])
kp_page_up = KeyCode(KEYPAD_KEYS['KP_Page_Up'])
kp_right = KeyCode(KEYPAD_KEYS['KP_Right'])
kp_space = KeyCode(KEYPAD_KEYS['KP_Space'])
kp_subtract = KeyCode(KEYPAD_KEYS['KP_Subtract'])
kp_tap = KeyCode(KEYPAD_KEYS['KP_Tab'])
kp_up = KeyCode(KEYPAD_KEYS['KP_Up'])
kp_begin = KeyCode(KEYPAD_KEYS['KP_Begin'])
then
class Listener(ListenerMixin, _base.Listener):
_KEYPAD_KEYS = {
KEYPAD_KEYS['KP_0']: Key.kp_0,
KEYPAD_KEYS['KP_1']: Key.kp_1,
KEYPAD_KEYS['KP_2']: Key.kp_2,
KEYPAD_KEYS['KP_3']: Key.kp_3,
KEYPAD_KEYS['KP_4']: Key.kp_4,
KEYPAD_KEYS['KP_5']: Key.kp_5,
KEYPAD_KEYS['KP_6']: Key.kp_6,
KEYPAD_KEYS['KP_7']: Key.kp_7,
KEYPAD_KEYS['KP_8']: Key.kp_8,
KEYPAD_KEYS['KP_9']: Key.kp_9,
KEYPAD_KEYS['KP_Add']: Key.kp_add,
KEYPAD_KEYS['KP_Decimal']: Key.kp_decimal,
KEYPAD_KEYS['KP_Delete']: Key.kp_delete,
KEYPAD_KEYS['KP_Divide']: Key.kp_divide,
KEYPAD_KEYS['KP_Down']: Key.kp_down,
KEYPAD_KEYS['KP_End']: Key.kp_end,
KEYPAD_KEYS['KP_Enter']: Key.kp_enter,
KEYPAD_KEYS['KP_Equal']: Key.kp_equal,
KEYPAD_KEYS['KP_F1']: Key.kp_f1,
KEYPAD_KEYS['KP_F2']: Key.kp_f2,
KEYPAD_KEYS['KP_F3']: Key.kp_f3,
KEYPAD_KEYS['KP_F4']: Key.kp_f4,
KEYPAD_KEYS['KP_Home']: Key.kp_home,
KEYPAD_KEYS['KP_Insert']: Key.kp_insert,
KEYPAD_KEYS['KP_Left']: Key.kp_left,
KEYPAD_KEYS['KP_Multiply']: Key.kp_multiply,
KEYPAD_KEYS['KP_Page_Down']: Key.kp_page_down,
KEYPAD_KEYS['KP_Page_Up']: Key.kp_page_up,
KEYPAD_KEYS['KP_Right']: Key.kp_right,
KEYPAD_KEYS['KP_Space']: Key.kp_space,
KEYPAD_KEYS['KP_Subtract']: Key.kp_subtract,
KEYPAD_KEYS['KP_Tab']: Key.kp_tap,
KEYPAD_KEYS['KP_Up']: Key.kp_up,
KEYPAD_KEYS['KP_Begin']: Key.kp_begin}
in i had to add this to remove mapping from _SPECIAL_KEYS (its ugly but oi dont know python well)
class Listener(ListenerMixin, _base.Listener):
def init(self, *args, **kwargs):
...
...
self._SPECIAL_KEYS.pop(Key.kp_0.value.vk)
self._SPECIAL_KEYS.pop(Key.kp_1.value.vk)
self._SPECIAL_KEYS.pop(Key.kp_2.value.vk)
self._SPECIAL_KEYS.pop(Key.kp_3.value.vk)
self._SPECIAL_KEYS.pop(Key.kp_4.value.vk)
self._SPECIAL_KEYS.pop(Key.kp_5.value.vk)
self._SPECIAL_KEYS.pop(Key.kp_6.value.vk)
self._SPECIAL_KEYS.pop(Key.kp_7.value.vk)
self._SPECIAL_KEYS.pop(Key.kp_8.value.vk)
self._SPECIAL_KEYS.pop(Key.kp_9.value.vk)
self._SPECIAL_KEYS.pop(Key.kp_add.value.vk)
self._SPECIAL_KEYS.pop(Key.kp_decimal.value.vk)
self._SPECIAL_KEYS.pop(Key.kp_delete.value.vk)
self._SPECIAL_KEYS.pop(Key.kp_divide.value.vk)
self._SPECIAL_KEYS.pop(Key.kp_down.value.vk)
self._SPECIAL_KEYS.pop(Key.kp_enter.value.vk)
self._SPECIAL_KEYS.pop(Key.kp_equal.value.vk)
self._SPECIAL_KEYS.pop(Key.kp_f1.value.vk)
self._SPECIAL_KEYS.pop(Key.kp_f2.value.vk)
self._SPECIAL_KEYS.pop(Key.kp_f3.value.vk)
self._SPECIAL_KEYS.pop(Key.kp_f4.value.vk)
self._SPECIAL_KEYS.pop(Key.kp_home.value.vk)
self._SPECIAL_KEYS.pop(Key.kp_insert.value.vk)
self._SPECIAL_KEYS.pop(Key.kp_left.value.vk)
self._SPECIAL_KEYS.pop(Key.kp_multiply.value.vk)
self._SPECIAL_KEYS.pop(Key.kp_page_down.value.vk)
self._SPECIAL_KEYS.pop(Key.kp_page_up.value.vk)
self._SPECIAL_KEYS.pop(Key.kp_right.value.vk)
self._SPECIAL_KEYS.pop(Key.kp_space.value.vk)
self._SPECIAL_KEYS.pop(Key.kp_subtract.value.vk)
self._SPECIAL_KEYS.pop(Key.kp_tap.value.vk)
self._SPECIAL_KEYS.pop(Key.kp_up.value.vk)
self._SPECIAL_KEYS.pop(Key.kp_begin.value.vk)
for a keyboard listener you do NOT want it to return the value of keys .. you want to be able to tell the difference between 1 and kp 1 and kp end ...
from pynput.
Related Issues (20)
- Keyboardtracking CTRL + "second_key" doesn't output "second_key"
- pynput not detecting media keys on kde plasma wayland HOT 1
- Type method crashes on cyrillic characters HOT 1
- Suppress mouse move not working when using parsec HOT 1
- mouse listener example for win32_event_filter HOT 1
- Script Continues Rapid Clicking Despite Mouse Button Release (is_pressed Functionality Issue) HOT 6
- Press cmd_r and release with cmd pressed will produce two presses instead of press + release HOT 3
- Can this be used in Micropython? HOT 5
- Get the original pressed key HOT 1
- The Numpad numbers does not work in HotKeys.
- pynput types ">" instead of "|" HOT 1
- Need to sync keyboard lock keys
- AttributeError: record_create_context HOT 5
- capslock crshed on macOS HOT 2
- lazy imports cause a KeyError HOT 4
- Cannot install on linux Ubuntu (depends on pywin32) HOT 2
- name 'keyboard' is not defined HOT 1
- Additional keys can still trigger events HOT 2
- Missing 1.7.7 tarball on PyPI
- How can I suppress/disable the left click or right click, or any specific key HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pynput.