0

im working on a project where i need to use python to "press keys" i receive the letter i need to click through sockets and then i need some code to do the click on the keyboard by the key i got.
But
i need to click the key without printing it nowhere. i tryied using PyKeyboard. the key was pressed, but i almost crushed my computer when i figure out it print the key 'w' for million times.

the project is basicly an app that is a contorller and u can play a game on a pc through the controller app. im using the keyboard because i couldnt find out a way that easy to work to fake a virtual controller or use other drivers. - i know it wont be as responsable as real controller.

edit-- there is no much code to add im just in the progress of checking if when i press the 'W' or 'space' in the keyboard - if it will do such things in the game - for example - Rocket leauge (it is the easier to check - by time)

Ido
  • 55
  • 7

1 Answers1

0

Use Pyautogui module

pyautogui.press('Enter')
pyautogui.typewrite('Hello World')
mickNeill
  • 346
  • 5
  • 22
  • i tried it but it does the same as pykeyboard. i came across a question that involve ctypes and other stuff in order for python to send keys to big games such as minecraft,Rocket leauge and etc... they use directX and more of that stuff. but i cant make it work. – Ido Jan 09 '18 at 12:55