Как зажать пкм использую любую библиотеку
Используя любую библиотеку пайтон нужна зажать пкм
Источник: Stack Overflow на русском
Используя любую библиотеку пайтон нужна зажать пкм
Для этого воспользуйтесь библиотекой pyautogui
. Исходя из документации, вы можете использовать функцию mouseDown
:
import pyautogui # Импортировать библиотеку
pyautogui.mouseDown(button = 'right') # Держать правую клавишу мышки
Текст из документации:
Mouse clicks and drags are composed of both pressing the mouse button down and releasing it back up. If you want to perform these actions separately, call the mouseDown() and mouseUp() functions. They have the same x, y, and button. For example:
pyautogui.mouseDown(button='right') # press the right button down pyautogui.mouseUp(button='right', x=100, y=200) # move the mouse to 100, 200, then release the right button up. pyautogui.mouseDown(); pyautogui.mouseUp() # does the same thing as a left-button mouse click
Чтобы отпустить мышку, используйте функцию mouseUp
:
pyautogui.mouseUp()
Для установки библиотеки:
py -m pip install pyautogui
.python -m pip install pyautogui
.