Please mind that I am completely green in Python and I do not know how callbacks work in this language.
I have been trying for some time to solve my problem, but I cannot figure out what to do.
I have the problem with using callbacks in Python. I use the Python keyboard module to listen to keys pressed on a machine.
When I try to use the keyboard.hook() method, it asks me for a callback. I know how callbacks work, but as long as Python is not my main language I can't really figure out what to do with it.
In JavaScript it's as easy as naming a parameter in a function then printing that parameter. Easy as that.
import keyboard
keyboard.hook()
## How to print keys?
In the official documentation, it is written that the hook() method invokes a callback. How do I access this callback and most importantly print keys which are recorded from it? I just need a simple example then I will be able to remember it forever.
Any help really appreciated.
def foo(): # some codeand thenkeyboard.hook(foo)