for joy_id in range(pygame.joystick.get_count()): joystick = pygame.joystick.Joystick(joy_id) joystick.init() joysticks[joy_id] = joystick
Then you should start getting events for all the joystick devices. I didn't have luck with my gamepad so I gave up and bought a joystick. I hated that thing anyway. It hurt my fingertips, so I backed up over the USB jack repeatedly with my chair. Gumm On Sat, Nov 28, 2009 at 11:59 AM, Jackson Raniel Florencio da Silva <jacksonran...@ig.com.br> wrote: > Hello everybody! > > I'm new to the list in python as well. I am studying the Pygame library and > wrote the following script: > > import pygame > from pygame.locals import * > from sys import exit > > pygame.init( > > ) > SCREEN_SIZE = (800, 600) > screen = pygame.display.set_mode(SCREEN_SIZE, 0, 32) > > font = pygame.font. SysFont("arial", 16); > font_height = font.get_linesize() > event_text = [] > > while True: > > event = pygame.event. wait() > event_text.append(str(event)) > event_text = event_text[-SCREEN_SIZE[1]/font_height:] > > if event.type == QUIT: > exit() > > screen.fill( (255,255,0)) > > y = SCREEN_SIZE[ 1]-font_height > for text in reversed(event_text): > screen.blit(font.render(text, True, (0,0,123)),(0,y)) > y-= font_height > > pygame.display. update() > > > It captures all the events (actions) of my keyboard and mouse and write in a > window that he creates. But, theoretically, it should capture the events of > my joypad too, but it does not. How can I make this script also captures the > events of my joypad? > > I am developing in the IDE Geany in Ubutu 9:04 and my joypad is a Leadership > Gamer Joypad Attacker 6740. > > Thaks. > > -- > Jackson Raniel > >