New to Python: win32con error when using MOUSEEVENTIF_LEFTDOWN

I have been trying to make an “Aimbooster” bot in Python. “Aimbooster” is essentially a game where circles appear on the screen, and you have to try and click them as fast as possible ( link:

I wanted to first test out if I could click somewhere on the screen (in general) using pre-set pixel co-ordinates (such as 100, 100). The code (along with the modules I have been using) is below:

from pyautogui import *
import pyautogui
import time
import keyboard
import random
import win32api, win32con


def click(x, y):
    win32api.SetCursorPos((x, y))
    win32api.mouse_event(win32con.MOUSEEVENTIF_LEFTDOWN, 0, 0)
    win32api.mouse_event(win32con.MOUSEEVENTIF_LEFTUP, 0, 0)

click(100, 100)

Note: the time.sleep(2) is just there so I can quickly switch to the “Aimbooster” site when the bot is finished.

However, whenever I run the code, I get this error message:

AttributeError: module 'win32con' has no attribute 'MOUSEEVENTIF_LEFTDOWN'

I do not want to use another method such as pyautogui.leftClick(100, 100) because it is quite slow in my experience, and the “Aimbooster” test is quite fast.

If you what is going on and how I can fix this, your assistance would be greatly appreciated. :slight_smile:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.