Вот есть код:
from AutoHotPy import AutoHotPy
from InterceptionWrapper import InterceptionMouseState,InterceptionMouseStroke
def exitAutoHotKey(autohotpy,event):
"""
exit the program when you press ESC
"""
autohotpy.stop()
def rightButton(autohotpy,event):
"""
This function simulates a right click
"""
stroke = InterceptionMouseStroke() # I highly suggest you to open InterceptionWrapper to read which attributes this class has
#To simulate a mouse click we manually have to press down, and release the buttons we want.
stroke.state = InterceptionMouseState.INTERCEPTION_MOUSE_RIGHT_BUTTON_DOWN
autohotpy.sendToDefaultMouse(stroke)
stroke.state = InterceptionMouseState.INTERCEPTION_MOUSE_RIGHT_BUTTON_UP
autohotpy.sendToDefaultMouse(stroke)
def leftButton(autohotpy,event):
"""
This function simulates a left click
"""
print("ee")
stroke = InterceptionMouseStroke()
stroke.state = InterceptionMouseState.INTERCEPTION_MOUSE_LEFT_BUTTON_DOWN
autohotpy.sendToDefaultMouse(stroke)
stroke.state = InterceptionMouseState.INTERCEPTION_MOUSE_LEFT_BUTTON_UP
autohotpy.sendToDefaultMouse(stroke)
import time
if __name__=="__main__":
auto = AutoHotPy()
auto.registerExit(auto.ESC,exitAutoHotKey) # Registering an end key is mandatory to be able tos top the program gracefully
# lets switch right and left mouse buttons!
auto.registerForMouseButton(InterceptionMouseState.INTERCEPTION_MOUSE_LEFT_BUTTON_DOWN,leftButton)
while True:
time.sleep(1)
leftButton(InterceptionMouseState.INTERCEPTION_MOUSE_LEFT_BUTTON_DOWN, 500)
auto.start()
Какой аргумент нужно указать в leftButton()?