boppreh / keyboard

Hook and simulate global keyboard events on Windows and Linux.
MIT License
3.74k stars 432 forks source link

keyboard.block() doesn't work #622

Open A-Little-on-the-Nose opened 7 months ago

A-Little-on-the-Nose commented 7 months ago

I have tried to use current_key to find the key name of the key that is pressed but the problem is that when I give it to the keyboard.block() function, it tell me the following error: ValueError: Can only normalize non-empty string names. Unexpected ''

` def isLimitReached(self): text = self.sender().toPlainText()

    accepted_keys =["left","right","up","down","backspace"]

    if len(text) > 508:

        if keyboard.get_hotkey_name() not in accepted_keys:

            current_key = keyboard.get_hotkey_name()
            keyboard.block(current_key)
    else:
        print(text)`