I wanted to move the mouse cursor with my ps4 controller, so I used pygame and win32api
I came up with this solution to the problem, but it is not working as I intended, because it is extremely laggy
for event in pygame.event.get():
    if event.type == pygame.JOYAXISMOTION:
        if event.value > self.threshold :
            if event.axis == 2:  
                win32api.SetCursorPos([win32api.GetCursorPos()[0] + self.sensitivity, win32api.GetCursorPos()[1]])
            if event.axis == 3:
                win32api.SetCursorPos([win32api.GetCursorPos()[0], win32api.GetCursorPos()[1] + self.sensitivity])   
        if event.value < -self.threshold :
            if event.axis == 2:  
                win32api.SetCursorPos([win32api.GetCursorPos()[0] - self.sensitivity, win32api.GetCursorPos()[1]])
            if event.axis == 3:
                win32api.SetCursorPos([win32api.GetCursorPos()[0], win32api.GetCursorPos()[1] - self.sensitivity])
this just checks if a joystick is in motion, and then translates this movement to the cursor with a given sensitivity by adding that same value to the current position:
win32api.SetCursorPos([win32api.GetCursorPos()[0] + self.sensitivity, win32api.GetCursorPos()[1]])
Is there any other efficient solution that won't lag my pc?