[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Spam problem with joystick module



The calls to get_axis and get_button cause these outputs...
Maybee there is another way of getting the values?..

2009/11/12 rouiller olivier <o.rouiller@xxxxxxxxx>
Here is the code I use to test the pad, I found it on the net.

pygame.init()
#joystick.init()
j = pygame.joystick.Joystick(0)
j.init()
#print 'Initialized Joystick : %s' % j.get_name()
try:
    while True:
        pygame.event.pump()
        for i in range(0, j.get_numaxes()):
            if j.get_axis(i) != 0.00:
                pass
                #print 'Axis %i reads %.2f' % (i, j.get_axis(i))
        for i in range(0, j.get_numbuttons()):
            if j.get_button(i) != 0:
                pass
                #print 'Button %i reads %i' % (i, j.get_button(i))
except KeyboardInterrupt:
    j.quit()

As you can see I commented the prints but I still have the same output :
SDL_JoystickGetButton value:0:
SDL_JoystickGetButton value:0:
SDL_JoystickGetAxis value:-257:
SDL_JoystickGetAxis value:-257:
SDL_JoystickGetAxis value:-257:
SDL_JoystickGetAxis value:-257:
SDL_JoystickGetButton value:0:

And so on...
Were you able to use a joystick without output?
If so do use a different of pygame or python?

Thanks for the help!



2009/11/12 Alex Nordlund <deep.alexander@xxxxxxxxx>

Check your code, comment out every line that begins with 'print' ;-)

---
//Alex


On Thu, Nov 12, 2009 at 11:23 PM, Thiago Chaves <shundread@xxxxxxxxx> wrote:
> You might want to be more specific.
>
> -Thiago
>
> On Thu, Nov 12, 2009 at 7:36 PM, rouiller olivier <o.rouiller@xxxxxxxxx>
> wrote:
>>
>> Hi everyone,
>>
>> I am trying to use a gamepad for a game project but whenever I check for a
>> pad event I get some printing in the console.
>> I saw some discutions about the subject but no solution.
>>
>> I am on windows7 python26 pygame191 and I develop on Eclipse with pydev.
>>
>> Does someone have encounter the same problem and found a solution?
>>
>> Thx for your help.
>>
>> Regards.
>> Olivier
>>
>> --
>> Rouiller Olivier
>> 06 79 66 89 63
>> Résidence Léonard de Vinci
>> App. A008
>> 59650 Villeneuve d'Ascq
>>
>>
>>
>> --
>> Rouiller Olivier
>> 06 79 66 89 63
>> Résidence Léonard de Vinci
>> App. A008
>> 59650 Villeneuve d'Ascq
>
>



--
Rouiller Olivier
06 79 66 89 63
Résidence Léonard de Vinci
App. A008
59650 Villeneuve d'Ascq



--
Rouiller Olivier
06 79 66 89 63
Résidence Léonard de Vinci
App. A008
59650 Villeneuve d'Ascq