Gordon Zar
Gordon Zar

Reputation: 151

Pygame wrongly detects joystick that isn't there

I have a strange problem with pygame I have no joystick connected to my laptop but pygame.joystick.get_count() returns 1 It even detects axis inputs. The devices connected to my computer are: mouse, keyboard and a wacom intuos.

No other USB devices are connected. EDIT: I have made the following test script

import pygame

pygame.init()
pygame.joystick.init()
print("joystick count:",pygame.joystick.get_count())
gJoystick = pygame.joystick.Joystick(0)
gJoystick.init()
print(gJoystick.get_init())
fGetEvent = True
while fGetEvent:
    for event in pygame.event.get():
        if event.type == pygame.JOYBUTTONDOWN:
            print("joystick button pressed")
            fGetEvent = False

gJoystick.init()
print(gJoystick.get_numaxes())

When I press a button on my intuos tablet, it registers as a joystick button press. Do I have to disconnect my tablet to make this work properly?

Upvotes: 1

Views: 239

Answers (1)

ItsMeNaira
ItsMeNaira

Reputation: 358

Yes, a plethora of programs, python included, detect wacom tablet inputs as joystick inputs. You just have to unplug it.

Upvotes: 1

Related Questions