make a keyboard input command from a python script

io, keyboard, python

Solution

In Windows, you can use pywin32 to make a keypress. See this previous answer for a code example.

In Linux, this previous answer has you covered, using xsendkey or xsendkeycode

And for Macs, another previous answer using PyQt or wxPython.

Problem

is there any way to make keyboard input from my program. suppose my program reeives "1" from a socket. how this data can be converted to a real time keyboard hit. means when "1" would receive , the computer would think that i pressed "1" .

Original source

Related problems