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

[pygame] PyGame Joysticks and PyGTK



Hello,

I am trying to write a simple GTK application using PyGTK. It is
mostly written using buttons to trigger events being sent over an
RS232 cable (using pyserial). However, I would like to be able to add
Joystick support to the application. I have already written a CLI
version of the application in Python using PyGame.Joystick module and
it works well.

However, I havn't even begun to move the Joystick code into the PyGTK
code as I don't know where I would put it. PyGame has its own loop I
believe and at least require these two lines before it works:

    pygame.joystick.init()
    pygame.display.init()

Then I have a Joystick Event Handler than takes care of everything
else.

Am I safe to run these commands inside a separate thread or something?
So I can still have the GTK Main Loop running, as well as handle the
Pygame Event inputs from the Joystick?

Any help with this would be amazing.

Cheers,

Andrew Barlow