Как зажать пкм использую любую библиотеку

Используя любую библиотеку пайтон нужна зажать пкм


Ответы (1 шт):

Автор решения: Brainsluggy

Поднять мышку

Для этого воспользуйтесь библиотекой 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()

Установка библиотеки

Для установки библиотеки:

  1. Откройте терминал
  2. Введите команду:
    2.1. Если у вас Windows, напишите py -m pip install pyautogui.
    2.2. Если у вас Linux, напишите python -m pip install pyautogui.
  3. Нажмите Enter и радуйтесь.
→ Ссылка