class KeyBdInput(ctypes.Structure):
    _fields_ = [('wVk', ctypes.c_ushort), ('wScan', ctypes.c_ushort), (
        'dwFlags', ctypes.c_ulong), ('time', ctypes.c_ulong), (
        'dwExtraInfo', PUL)]


class HardwareInput(ctypes.Structure):
    _fields_ = [('uMsg', ctypes.c_ulong), ('wParamL', ctypes.c_short), (
        'wParamH', ctypes.c_ushort)]


class MouseInput(ctypes.Structure):
    _fields_ = [('dx', ctypes.c_long), ('dy', ctypes.c_long), ('mouseData',
        ctypes.c_ulong), ('dwFlags', ctypes.c_ulong), ('time', ctypes.
        c_ulong), ('dwExtraInfo', PUL)]
Имитация нажатия клавиш Python для управления игрой