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

How to check if special key been pressed using pynput

For normal alphanumeric keys it can be checked as fallow: def on_press(key): try: if key.char == "a": # do sth but what about special keys like f1 or Ctrl ?
mike
  • 45
  • 5
-1
votes
2 answers

On right click with pynput

I'm trying to globally detect a right-click and run an event on that right-click by using pynput's on_click() function. Here's my code currently: import pynput from pynput.mouse import Listener, Button, Controller mouse = Controller() def…
notjack
  • 5
  • 1
  • 2
-1
votes
3 answers

Python check if Left Mouse Button is being held?

I'm pretty new to Python and I'd like to make a kind of an Autoclicker, which keeps clicking every 0.1 seconds when my left mouse button is held down. My Problem is, that when I run my script, my mouse instantly starts clicking. What should I…
Dom
  • 47
  • 2
  • 7
-1
votes
2 answers

Could someone explain me this strange Python for loop?

I was occupied on a project and I found a code that was perfectly what I was searching for, but there are parts that I don't understand could some of you explain me it please? This is the code that I found: from pynput import keyboard from…
i799
  • 1
  • 2
-1
votes
1 answer

Is is possible to send a variable using python's pynput?

I have made a python script to do some math for me. I then used this pynput script import pynput from pynput.keyboard import Key, Controller import time keyboard = Controller() def type(char): keyboard.press(char) …
Pepe
  • 41
  • 7
-1
votes
1 answer

Python Locking the mouse and keyboard

I am writing a code in which I need to lock the user's input via mouse and keyboard. I am using sockets and when i get the message "LOCK" it should lock the computer and when I get the message "UNLOCK" it will unlock the user's PC. I've tried using…
-1
votes
1 answer

I'm a newbie in image processing getting an error "Don't know how to convert parameter 1"

I'm using opencv on windows. This error occurs only after detecting green colour (which obviously is the task of the code). CODE: import cv2 import numpy as np from pynput.mouse import Button, Controller import…
-2
votes
0 answers

Automating an 'fn + space' keystroke on startup

I just got a new Lenovo Thinkpad E14 Gen 3, and my OCD wants the backlit keyboard on all the time. There is NO setting to keep the light on at all times (not even in the BIOS), and the keystroke to turn it on is 'Fn + Space'. At first, I thought I'd…
Seth Bowers
  • 31
  • 1
  • 6
-2
votes
0 answers

How to not open the context menu if a mouse gesture is executed?

I have a program that is working, but it opens the context menu after simulating the commands. (That's because it's done with the right mouse button). Is there a way to not open the context menu if a mouse gesture is executed? from pynput.mouse…
-2
votes
1 answer

Requirement already satisfied: pynput

I have a problem I got such error after using this command python -m pip install pynput Requirement already satisfied: pynput in c:\users\user\appdata\local\programs\python\python310\lib\site-packages (1.7.6) Requirement already satisfied: six in…
nothenan Caly
  • 41
  • 1
  • 1
  • 5
-2
votes
1 answer

Taking screenshot of a specific space using python

I am trying to take a screenshot of a specific region using python. I wrote this code: import pyscreenshot from pynput.mouse import Listener x=1 y=1 def on_click(x1, y1, button, pressed): global x,y x = x1 y = y1 def on_release(x2,y2,…
Surya nath
  • 65
  • 8
-2
votes
1 answer

a click counter that displays how many times you clicked left mb using python 3.8 , tkinter , win32 and pynput

Here is the very basic example . I've found the displaying script from this website and copied the mouse listener from pynput's documentary . When i remove the counter part it succesfully displays the value of clickamount variable but when i add it…
-2
votes
1 answer

Variables in python with pynput

So I'm making a program that types a number using pynput, then adds 1 to that number, hits enter, and keeps going. However, when it hits 10, the program stops working. Here's my code: from pynput.keyboard import Key, Controller import time keyboard…
-4
votes
1 answer

How do i see if a key is pressed down using Pynput in Python?

I want to (by using Pynput in Python) see if a key is pressed down. For example: while True: if #key alt is pressed down: print("Alt is pressed down")
MY_name
  • 25
  • 5
1 2 3
43
44