Simulate XBox controller input with Python

I want my python program to simulate the input of an XBox controller. Both analog joysticks and on / off buttons, if possible.

I found themes to simulate keyboard input using ctypes in python, for example here: Python mimics keydown

Is it possible to simulate it like a “keydown” on a regular keyboard or mouse?

+4
source share
1 answer

If someone with the same problems finds this thread:

I solved the problem with vJoy, pyVJoy and x360ce.

vJoy SDK . , .. PyvJoy python. https://github.com/tidzo/pyvjoy pyvJoy 0 32767 "" . , xbox , XAxis YAxis 1/2 32767.

, 0 1, . :

MAX_VJOY = 32767
self.j = pyvjoy.VJoyDevice(1)

def play_function(self,X,Y,Z,XRot):
    self.j.data.wAxisX = int(X * self.MAX_VJOY)
    self.j.data.wAxisY = int(Y * self.MAX_VJOY)
    self.j.data.wAxisZ = int(Z * self.MAX_VJOY)
    self.j.data.wAxisXRot = int(XRot * self.MAX_VJOY)
    j.update()

"" / "" , pyvjoy github . Joystick : http://www.planetpointy.co.uk/joystick-test-application/

X360CE, vJoy "DigitalInput" Devide XInput. , / , Xbox 360 Xbox One Controller. , Xbox, GTA 5. X360CE : http://www.x360ce.com/

python. , WASD , , 1 0 . .

+4

Source: https://habr.com/ru/post/1675101/


All Articles