Giter Site home page Giter Site logo

pywinhook's Introduction

A pyHook fork with some updates for support latest Visual Studio compilers.
See the website, http://pyhook.sourceforge.net/, for the original pyHook project.

Known bugs
----------
- PyInstaller can't build single-file executables using pyWinhook. This may be
  fixed in 1.5.1, but hasn't been tested.
- pyWinhook is reported to break dead keys on non-US-english keyboards.
- WM_CHAR messages are not intercepted by pyWinhook, even if SubscribeKeyChar() or
  SubscribeKeyAll() are used to set the callback function.

Limitations
-----------
- pyWinhook will not work on Win9x (no messages show up) as it uses hooks which
  are not present in Windows systems prior to NT 4.0 SP3.

pywinhook's People

Contributors

tungsteno74 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pywinhook's Issues

Installation on Windows 11 on arm fails

Hey everybody,

just wanted to report that the installation on Windows on arm fails with error: command 'swig.exe' failed: None.

Let me know if I could support to make pyWinhook Windows on arm compatible.

Greetings

Edit: ok, same on amd64 based system - so I guess it's probably unrelated to arm/amd64...

AttributeError: 'HookManager' object has no attribute 'keyboard_hook'

Code

import pyWinhook

hm = pyWinhook.HookManager()

Error

Exception ignored in: <function HookManager.__del__ at 0x00000260F1A4E558>
Traceback (most recent call last):
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\pyWinhook\HookManager.py", line 279, in __del__
    self.UnhookKeyboard()
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\pyWinhook\HookManager.py", line 299, in UnhookKeyboard
    if self.keyboard_hook:
AttributeError: 'HookManager' object has no attribute 'keyboard_hook'
Exception ignored in: <function HookManager.__del__ at 0x00000260F1A4E558>
Traceback (most recent call last):
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\pyWinhook\HookManager.py", line 279, in __del__
    self.UnhookKeyboard()
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\pyWinhook\HookManager.py", line 299, in UnhookKeyboard
    if self.keyboard_hook:
AttributeError: 'HookManager' object has no attribute 'keyboard_hook'
Exception ignored in: <function HookManager.__del__ at 0x00000260F1A4E558>
Traceback (most recent call last):
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\pyWinhook\HookManager.py", line 279, in __del__
    self.UnhookKeyboard()
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\pyWinhook\HookManager.py", line 299, in UnhookKeyboard
    if self.keyboard_hook:
AttributeError: 'HookManager' object has no attribute 'keyboard_hook'

Solution

Open HookManager.py and change all key_hook words to keyboard_hook

Incorrect import paths on python3

I just installed pyWinhook on windows with python 3.6 and it threw an exception on import.
After looking into it, I changed from HookManager import * to from .HookManager import * and
import cpyHook to from . import cpyHook and it seems to work fine so far.

Unicode title error

if I switch widows than show this error message.

TypeError: KeyboardSwitch() missing 8 required positional arguments: 'msg', 'vk_code', 'scan_code', 'ascii', 'flags', 'time', 'hwnd', and 'win_name'

can you fix this error?
please help

Caret character (^) is duplicated

Whenever I'm running a script that uses pyHook in the background if I use the caret character, it gets input twice on my computer (actually typing in 2 times).

I am using a French AZERTY layout keyboard where pressing the ^ or ¨ key is not supposed to print any character, but rather wait for another character input to combine it. For example pressing ^ then e should print ê, but pressing ^ twice should print ^^.

EDIT: Just learnt about "dead keys" and how it's a known issue with pyWinhook, we can consider this issue closed as insolvable then.

is there a way to prevent OnKeyboardEvent(event) from "interrupting" device input?

I'm basically using the example.py supplied in this repo, but with a time.sleep(1) added at the end of OnKeyboardEvent(event). Is there any way to make it so this sleep (or any other slow code) doesnt interfere with mouse movement and normal keyboard inputs?

you can see the "issue(?)" in the gif below; when I start typing, the mouse starts lagging and I can only type 1 letter per second:
https://i.gyazo.com/bda25fe6d8f92a8935621fb7927dc9b7.mp4

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.