ANTICHAT

ANTICHAT (https://forum.antichat.xyz/index.php)
-   Общие вопросы программирования (https://forum.antichat.xyz/forumdisplay.php?f=206)
-   -   AutoHotPY на питоне, как? (https://forum.antichat.xyz/showthread.php?t=1387271)

GasikPasik 08.05.2021 14:04

Я не поинмаю, что именно надо за аргумент надо указать в AutoHotPY?

Вот есть код:

Python:





Код:

# -*- coding: utf-8 -*-
"""
@author: Emilio Moretti
Copyright 2013 Emilio Moretti
This program is distributed under the terms of the GNU Lesser General Public License.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see .
"""
#WARNING: handling mouse events is harder than keyboard events.
# You have to do most things manually
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
)
:
stroke
=
InterceptionMouseStroke
(
)
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
)
:
"""
    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
=
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
)
auto
.
start
(
)



Тут идёт вызов при событие(нажатие ЛКМ), что мне надо указать в функцию leftButton(), чтобы просто вызвать её?

Я понимаю, что надо убрать event из аргументов и предполагаю, что

в аргумент "autohopy" - надо запихать переменную auto... точне я так думал, но это не работает.

Пожалуйста хелпаните!


Время: 04:07