python – pyautogui The left mouse button is not held down in the game


Given : Playing in windowed mode, OS: Windows 10 x64

Objective : Write code in Python 3.7+

  1. Drag the mouse pointer to a specific position <— Works
  2. Hold down the left mouse button <— Does not work
  3. Move the mouse pointer to a specific position <— Works
  4. Release the left mouse button <— Works

What has been done :

import pyautogui
import time

# pyautogui.dragTo и pyautogui.drag не работают.

pyautogui.moveTo(777, 777)
pyautogui.moveTo(555, 555)

Result : The mouse pointer is moved to the specified point, the mouse button is not held down.

The libraries I used to solve this problem, but they didn't work :

  1. win32api.mouse_event
  2. pydirectinput
  3. pywinauto

Keystrokes, mouse movement, mouse clicks work fine.


The button is clamped … The thing is that the game cancels all clicks if the mouse does not move naturally.

Scroll to Top