Questions tagged [pynput]

pynput is a Python library for controlling and monitoring input devices.

From pynput's Python Package Index page:

This library allows you to control and monitor input devices.
Currently [as of late 2018], mouse and keyboard input and monitoring are supported.

659 questions
-1
votes
1 answer

pyqt6 subprocess.run function always returns the same value even if the caps lock status changes

Since the keyboard indicator widget cannot be run on my kali system, I decided to write one myself using pyqt. I found that it would be normal if I separated the program and ran it, but not with pyqt6. It runs normally on Windows, but a very strange…
Sepu Ling
  • 1
  • 2
-1
votes
1 answer

py script stop after execute

I have the following script: import time from pynput import keyboard from pynput.keyboard import Key, Listener STATUS=False COMBINATION={keyboard.Key.esc, keyboard.Key.alt} # The currently active modifiers current = set() def on_press(key): …
Felipe
  • 452
  • 2
  • 7
  • 18
-1
votes
1 answer

How can I write a sentence or word using this syntax?

Here is the code I have: import os from pynput.keyboard import Key, Controller import time os.startfile('C:\\Users\\A\\Desktop\\Blank_Document.docx') time.sleep(3) keyboard = Controller() key = "Books are enjoyable to…
user19129062
-1
votes
1 answer

No Module Named Pydirectinput

I have a problem and ı cant find anythink to help. I am getting the error shown in the image
nothenan Caly
  • 41
  • 1
  • 1
  • 5
-1
votes
2 answers

Using a key in a for loop

I am trying to use the enter key to show different text after pressing it from pynput.keyboard import Key, Listener k=0 def on_press(key): pass def on_release(key): if key==Key.enter: k=k+1 with Listener(on_press=on_press,…
anas
  • 1
  • 1
-1
votes
1 answer

Can't import pynput.mouse Controller, Button

I've installed pynput by using these 2 commands in terminal. pip install pynput python -m pip install pynput Both work and it seems that the package was installed correctly - checked in the terminal. but when I run: from pynput.mouse import…
Naipi
  • 1
-1
votes
1 answer

Ctrl + c / Ctrl + v with memory effect

I think, that it would sometimes greatly improve your workflow, if you could ctrl + c (copy) in a series. That means, that when pressing ctrl +c is pressed, the content is stored in the memory until ctrl + v releases all the strings in memory.…
Uwe.Schneider
  • 1,112
  • 1
  • 15
  • 28
-1
votes
3 answers

python inputs on windows optimized ? ( and xbox guide button possible to detect ? )

In Short : any suggestion on how to listen to Xbox guide button ? or any suggestion on how to make "inputs" more optimized and faster for low-end PCs ? hey. I had been looking for a way to make screenshots on windows easier. for now the only…
Cool guy
  • 175
  • 2
  • 7
-1
votes
1 answer

What is the syntax in pynput for the Num Lock Key

In my program I use pynput to control my mouse and keyboard. Everything else working as intended but I cannot find the syntax to reference using the Num Lock key on my keyboard keyboard.press(Key.nmlk) This is my current guess at what the syntax…
-1
votes
1 answer

PYINSTALLER FAILED TO EXECUTE SCRIPT (used pynput)

Recently, I have installed pyinstaller 4.2. This is the error I get after running the script from cmd: Traceback (most recent call last): File "Keylogger.py", line 1, in File "PyInstaller\loader\pyimod03_importers.py", line 359, in…
ComputerBoi
  • 37
  • 1
  • 1
  • 7
-1
votes
1 answer

How can I make a function repeat until a specific key is pressed on python with pynput?

I want to do something like this while True: fuction() function_that_checks_if_q_is_pressed() if function_that_checks_if_q_is_pressed==True: break break Quick notes: I'm using ios mojave. i'm using python 3.9. The "keyboard"…
Raz P
  • 1
  • 1
-1
votes
1 answer

How to limit the keys pressed using pynput

I have made a code to stimulate the game using face detection. I find the centre of the face and upon its movement, I press the keys with pynput library. The code is working perfectly fine but its just a small issue whenever it detects a movement of…
-1
votes
1 answer

How to click mouse button rapidly when key is held down

how do I trigger the mouse being clicked rapidly when a key is held down (shift key in this instance). My code is currently import win32api import win32con import time …
Bob Stone
  • 90
  • 1
  • 13
-1
votes
1 answer

How to create a timer that times for how long a certain key is pressed in python?

keys_pressed=[] def keytracker(): def on_press(key): global start,stop start=time.time() print(key) keys_pressed.append('t') def on_release(key): stop = time.time() print(stop-start) if key==Key.esc: …
sanguine
  • 107
  • 1
  • 8
-1
votes
1 answer

TypeError: 'Button' object is not callable (pynput)

me (and my friend) are making an autockicker, the code i made (whitch works on its own) dose'nt work with her's. i get the error: TypeError: 'Button' object is not callable whitch i think is somthing to do with pynput i have no clue what to try,…
Zax71
  • 45
  • 7
1 2 3
43
44