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
3
votes
1 answer

pynput on_press triggerd by own keyboard.press

Like described in the titel, the function on_press of the pynput listener gets triggerd by it's own keypress. I tried doing several things, like adding a boolean that makes it so that when the code itselfs run the keypress or keyrelease, it doesn't…
novun
  • 249
  • 2
  • 3
  • 14
3
votes
2 answers

How to detect key press or hold in python when app not focus without using pynput

I am looking for a way to make my app get the input from keyboard when it's not being focused (I'm using Kivy). And I'm currently using Pynput module to do the key detecting part, but it's doesnt seem to work very well. -All of these problems only…
Ten Kho
  • 184
  • 10
3
votes
2 answers

Why does when I import pynput and use it it deletes my python file?

something weird is happening. In short explanation - my .py file gets deleted automatically when I use pynput lib Detailed explanation - I create a file called keylog.py I have installed ->pip install pynput, when I run the code: import…
yaron
  • 73
  • 5
3
votes
1 answer

Send mouse position every 0.2 seconds pynput

I am using pynput to send my mouse position every 0.2 seconds. I tried timing it: from pynput.mouse import Button, Listener as MouseListener def on_move(x,y): global start_time time_passed = start_time - time.time() if time_passed >=…
Guy zvi
  • 77
  • 1
  • 6
3
votes
0 answers

Pynput prints entered keys when Keyboard Listener finishes

This has been keeping me up quite a bit. When using the Python pynput module with keyboard.Listener, whatever is typed whilst the keyboard is listening is printed out in Terminal after the keyboard Listener has stopped. I've tried…
3
votes
1 answer

Python mouse.Listener and keyboard.Listener events trigger twice

I want to gather data when playing a game so I can learn an algorith to play it later. For this I need a key and mouse logger, this logger needs to: log mouse clicks and scrolls log any key presses. The problem I am having is that one mouse…
aaron
  • 31
  • 2
3
votes
1 answer

Is there a way to simulate Windows alt-tabbing?

I want to create a program which alt tabs into for example discord, and enters a message to a user. import time from pynput.keyboard import Key,…
sanguine
  • 107
  • 1
  • 8
3
votes
4 answers

How to press the windows key with pynput?

I am making a program in which I want to use Windows + D combination to navigate to desktop, but I am unable to find a windows key in Key. to do that. How can I do that? If not, is there any other way i should do this instead?
Akshay Singh
  • 31
  • 1
  • 3
3
votes
1 answer

Python argument to select a specific window

I'm trying to code a Discord bot, that when you type !start it starts a process on my computer and when you type !stop it stops the server, but here's the deal, when you type the command !stop it doesn't write my code in a cmd but wherever your…
Victor
  • 33
  • 5
3
votes
1 answer

pynput pip3 install ERROR: Could not find a version that satisfies the requirement pynput (from versions: none)

Gurus, I am trying to install pynput in python 3.5 & python 3.7 https://pypi.org/project/pynput/#files pip3 install pynput But get the following error message: Looking in indexes: https://nexus3.marqeta.com/repository/pypi-all/simple WARNING:…
Chubaka
  • 2,933
  • 7
  • 43
  • 58
3
votes
2 answers

How to listen letter keys with combination of modifier keys using pynput?

I am tying to automate some stuff using python.I use pynput to listen key combinations. I am trying to listen ctrl+shift+alt s combination. I have no problem with modifier keys but only with letter keys. I have looked the python documentation page…
Emre CEKEN
  • 31
  • 1
  • 2
3
votes
1 answer

How to detect keypress/release in pynput

I am using pynput to detect keypress release but I want to execute some different code on release of a specific key. Here is my code: 1 from pynput import keyboard 2 3 def on_press(key): 4 try: 5 print('Key {0}…
user12824087
3
votes
1 answer

Is there a way to reference backspace in python with pynput?

Hi everyone I want to know if there is any way to reference backspace for my project, I want to do if the person presses 'a' then it deletes it and types 'ree' can someone pls help me with this? Code: from pynput import keyboard from pynput.keyboard…
user12533869
3
votes
1 answer

Python Multithreading with pynput.keyboard.listener

I am building a self-driving rc car. The car is controlled by a raspberry pi (client) that sends image data to my computer (server) and the computer processes the image frames and responds to the car with what to do (all using python sockets). This…
marc.soda
  • 388
  • 1
  • 4
  • 17
3
votes
2 answers

Python create new line on space button press

I am running Python 3.8 (Also tested on 2.7). Attached below is code to a keylogger that I created with reference to a video tutorial as I'm fairly new to Python and trying to learn. I am trying to make it where when the space key is pressed, it…
1
2
3
43 44