Feb-13-2022, 07:01 PM
Hello all,
I'm messing around with a usb joystick I got online, and I cannot seem to get pygame to register it. I have written the following, simple code:
I'm messing around with a usb joystick I got online, and I cannot seem to get pygame to register it. I have written the following, simple code:
import pygame as pg pg.init() pg.joystick.init() screen = pg.display.set_mode((500,500)) running = True while running: for event in pg.event.get(): if event.type == pg.QUIT: running = False if event.type == pg.JOYBUTTONDOWN: print("button down") if event.type == pg.JOYBUTTONUP: print("button up") screen.fill((255,255,255)) pg.display.update() pg.quit()I expected it to print when i hit a button, but it doesn't seem to be registering at all, and I don't understand why. I also copied the example code from the pygame page, and that worked. What am I missing?