How to record mouse and keyboard movement simultaneously with Python?
问题 I want to create a function that records both mouse and keyboard events until a specific key is pressed and then replays them together. I think that this can be achieved with the keyboard and mouse modules. In an earlier question, I asked how to record the mouse movement until a key is pressed, and I got the following code: import mouse import keyboard events = [] #This is the list where all the events will be stored mouse.hook(events.append) #starting the mouse recording keyboard.wait("a")