Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

可以使用python的pynput 监听鼠标 这样就不用每次按组合按键了 通过鼠标左键 下一页 右键关闭 #16

Open
zhangjie45 opened this issue Jul 16, 2020 · 0 comments

Comments

@zhangjie45
Copy link

zhangjie45 commented Jul 16, 2020

import pynput
from pynput.keyboard import Controller, Key, Listener
from pynput.mouse import Button

def on_click(x, y, button, pressed):
# 实例化键盘
kb = Controller()

# 使用键盘输入一个字母
kb.press(Key.ctrl)
kb.press(Key.alt)
kb.press('.')
kb.release(Key.ctrl)
kb.release(Key.alt)
kb.release('.')
kb.pressed(Key.ctrl,Key.alt,'.')
if button == Button.right:
    print("关闭")
    return False

with pynput.mouse.Listener(
on_click=on_click,) as listener:
listener.join()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant