Reputation: 47
I want to create a program that if the user pressed shift and button-1 (left click), a GUI will pop up. However, I can only listen for key presses and mouse clicks separately using pynput. Is there a way to listen for those two things at the same time?
Upvotes: 0
Views: 5166
Reputation: 410
Here is the simple solution:
https://github.com/boppreh/mouse
https://github.com/boppreh/keyboard
import mouse
import keyboard
import time
while True:
if mouse.is_pressed(button='left') and keyboard.is_pressed('shift'):
print("Left mouse button and shift is pressed")
time.sleep(0.5)
Upvotes: 1