Skip to content

Instantly share code, notes, and snippets.

@zezic
Created July 20, 2018 14:28
Show Gist options
  • Save zezic/43255702182055481376a11604d6731c to your computer and use it in GitHub Desktop.
Save zezic/43255702182055481376a11604d6731c to your computer and use it in GitHub Desktop.
Produce Enter key tap when left mouse button clicked
from pymouse import PyMouseEvent
from pykeyboard import PyKeyboard
class Listener(PyMouseEvent):
def __init__(self):
PyMouseEvent.__init__(self)
self.keyboard = PyKeyboard()
def click(self, x, y, button, press):
if button == 1:
if press:
print('producing enter')
self.keyboard.tap_key(self.keyboard.enter_key)
listener = Listener()
listener.run()
@zezic
Copy link
Author

zezic commented Jul 20, 2018

You will need pyuserinput library to run this. Install it like this:

pip install pyuserinput

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment