Python Forum
Pynput while not using text field
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pynput while not using text field
#1
Hello,

So Pynput works great when you want to type characters, strings etc, it's great.
However, for a reason I cannot understand, when you want to use the feature of pynput elsewhere, it doesn't seems to work.
An example, if you're in a video game, and you want to crouch with the "C" key, it won't make you crouch, but if you're using the chat system of the online game, it will write "C"s.
There's also some flash games online when you just have to press the spacebar as fast as possible, and it doesn't work. (or only one space is recorded sometimes).
I tried to look up the documentation but I couldn't find anything about it.

Here's the piece of code I wrote:
from pynput.keyboard import Key, Controller
import time
import keyboard as key

keyboard = Controller()

time.sleep(2)
for i in range(30):
    #keyboard.press(Key.space)
    #keyboard.release(Key.space)
    keyboard.press("c")
    keyboard.release('c') 
    time.sleep(0.1)
I tried playing with the time.sleep value but it doesn't change anything.
Could anyone help me try to figure out why it doesn't work ? And how could I fix this issue ?
Thank you !
Reply
#2
There are instructions on leaving a message to the author of github page here: https://stackoverflow.com/questions/1268...b-com-user
in your case, author's repository is: https://github.com/moses-palmer/pynput
Reply
#3
Hello.

Thanks for the tip i'll try contacting with the author !
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Problem with "from pynput" LFreitas 1 129 Mar-24-2024, 02:23 AM
Last Post: deanhystad
  Pynput - One content on screen, another in the variable Valjean 4 887 Sep-18-2023, 06:00 PM
Last Post: Valjean
  Pynput Library not Working with Windows jacknewport 1 2,247 Mar-26-2022, 07:09 PM
Last Post: snippsat
  Bug ? when dataclass field name == field type Cyril 0 1,526 Oct-22-2020, 03:26 AM
Last Post: Cyril
  Solve Pynput Problem when changing language? ppel123 0 2,244 Feb-19-2020, 03:38 PM
Last Post: ppel123
  import pynput Sherlock42 2 3,295 Feb-08-2020, 04:01 PM
Last Post: Sherlock42
  text box field vishnu 4 2,150 Oct-04-2019, 06:38 AM
Last Post: vishnu
  Pynput doesn't recognize shift button and special characters VirtualDreamer 0 2,983 Jul-17-2019, 11:55 AM
Last Post: VirtualDreamer
  Pynput - no capital letters jmair 2 4,511 Feb-12-2019, 09:53 PM
Last Post: jmair
  Problem with updating file to attach/pynput jameseroni 7 4,403 Nov-02-2018, 03:47 AM
Last Post: jameseroni

Forum Jump:

User Panel Messages

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