Python Forum
Pynput Library not Working with Windows
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pynput Library not Working with Windows
#1
I'm trying to create a simple autoclicker where when I hold down on caps lock, the mouse will left click over and over again. I wrote a simple program that works well on my Mac, but on a Windows 10 computer it won't work. The code works fine when I just print something out while I'm holding down caps lock, but when I make it click while doing that, nothing happens. I'm running it on Visual Studio with Python 3. I'm pretty sure that pynput works well with Windows 10, so I'm confused about the problem. Thanks!

Here is my code:
import keyboard
import time
from pynput.mouse import Button, Controller

mouse = Controller()

toggle = False
while True:
    if keyboard.is_pressed('caps_lock'):
        mouse.click(Button.left, 1)
    time.sleep(0.04)
Reply
#2
Try running not from
(Mar-26-2022, 03:11 PM)jacknewport Wrote: I'm running it on Visual Studio with Python 3.
Try running from script from command line.
I haver tested code in Win-10,Python 3.10 and it work as it should.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Problem with "from pynput" LFreitas 1 188 Mar-24-2024, 02:23 AM
Last Post: deanhystad
  working directory if using windows path-variable chitarup 2 727 Nov-28-2023, 11:36 PM
Last Post: chitarup
  Pynput - One content on screen, another in the variable Valjean 4 966 Sep-18-2023, 06:00 PM
Last Post: Valjean
  Spyder stopped working in Windows 10 gammaray 3 3,067 Apr-19-2021, 05:33 PM
Last Post: jefsummers
  Does anyone have unicurses panel functions working on a Windows 10 platform? pjfarley3 0 1,458 Oct-11-2020, 04:41 AM
Last Post: pjfarley3
  error while installing any library using pip in windows AkashKansal 1 4,394 Sep-24-2020, 07:51 AM
Last Post: buran
  nsetools library not working in AWS jeeva 3 2,612 Aug-09-2020, 08:33 PM
Last Post: jeeva
  Solve Pynput Problem when changing language? ppel123 0 2,274 Feb-19-2020, 03:38 PM
Last Post: ppel123
  import pynput Sherlock42 2 3,338 Feb-08-2020, 04:01 PM
Last Post: Sherlock42
  python 3 and python 2 pips not working in windows gtx 5 5,009 Dec-28-2019, 12:21 AM
Last Post: flywire

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020