0

I need to use a joystick for a vpython project, Is it possibe to combine pygame module and vpython to be able to use joystick functions of the pygame module?

1 Answers1

1

Have you tried simply making pygame joystick calls in your vpython event/animation loop? Drop something like this in there, see how it goes (after importing pygame and initing up joysticks).

from pygame.joystick docs

for event in pygame.event.get(): # User did something        
    # Possible joystick actions: JOYAXISMOTION JOYBALLMOTION JOYBUTTONDOWN JOYBUTTONUP JOYHATMOTION
    if event.type == pygame.JOYBUTTONDOWN:
        print("Joystick button pressed.")
    if event.type == pygame.JOYBUTTONUP:
        print("Joystick button released.")
Christopher Peterson
  • 1,570
  • 1
  • 10
  • 9