You are not logged in.

#1 2022-04-24 14:35:04

superboxes
Member
Registered: 2022-04-24
Posts: 3

[SOLVED] What code can I use to click the left mouse button in Python?

So yeah, I use arch and I have been trying to code an autoclicker script in Python.
My code works on windows but doesnt work on arch linux.

Thanks for any help smile.

Code:
def autoclicker(k, c):
    while True:
        if keyboard.is_pressed(k): ##possibly problem
            randomInt = float(random.uniform(0.01, 0.06)) ## randomization
            mouse.click('left') ##problem
            SSS = c + randomInt
            time.sleep(SSS)
        else:
            pass

edit: by doesnt work, I mean it doesnt give any error, it just doesnt click.

use mouse.press(Button.left)
       mouse.release(Button.left)

Best regards,
SuperBoxes

Last edited by superboxes (2022-05-16 14:05:38)

Offline

#2 2022-04-24 22:39:28

nick_0189
Member
Registered: 2020-12-21
Posts: 45

Re: [SOLVED] What code can I use to click the left mouse button in Python?

I don't know if your issue is Arch specific, but what are your imports? You forgot to put them with the code. Also, please use code tags for code. It makes things easier to read.

Offline

Board footer

Powered by FluxBB