This code goes into infinite loop. I cant use A button on xbox 360 controller
import pygame
from pygame import joystick
pygame.init()
joystick = pygame.joystick.Joystick(0)
pygame.joystick.init()
print("start")
while True:
if joystick.get_button(0) == 1 :
print("stoped")
break

Personnaly, I can, so this seems to be possible. You are just missing that pretty much every user input needs to be updated by pygame through
pygame.event.get().From the pygame documentation:
So, apparently you need to get the events in the
whileloop like such to make the joystick work:Also,
if joystick.get_button(0) == 1, you don't need to type== 1because the statement is alreadyTrue.pygame.joysticktwice: through the linepygame.init()andpygame.joystick.init().from pygame import joystickbecause you already already have it in the lineimport pygame.