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
Test it on something like notepad. 2 or 3 cannot be typed, but 1 can be.
I don't know it is intended or not, I cannot find information about this.
Cover the callback, then it can be work well.
import keyboard
def callback1(*argv):
print(*argv)
return True
def cover(callback, *argv):
callback(*argv)
return None
# use covering
keyboard.add_hotkey("1", cover, args=[callback1, "1"], suppress=True)
# or use lambda
keyboard.add_hotkey(
"2",
lambda callback, *argv: None if callback(*argv) else None,
args=[callback1, "2"],
suppress=True,
)
keyboard.wait("esc")
Usually you don't need to use it like this, but if you need to use a function always returns True like the emit method of signal of pyside or pyqt, covering makes hotkey be suppressed.
The text was updated successfully, but these errors were encountered:
As the title, if the callback returns True, then hotkey does not be suppressed.
Next is an example code.
Test it on something like notepad. 2 or 3 cannot be typed, but 1 can be.
I don't know it is intended or not, I cannot find information about this.
Cover the callback, then it can be work well.
Usually you don't need to use it like this, but if you need to use a function always returns True like the emit method of signal of pyside or pyqt, covering makes hotkey be suppressed.
The text was updated successfully, but these errors were encountered: