Glad you got it working.
Yes, I suppose it could be confusing. My understanding is that keyboard are
generally sending events to a specific window, as that would be how the OS
handles it. Joysticks on the other hand are more independent, so they have
their own events.
Pyglet is undergoing a bit of a modernisation effort at the moment, and the
documentation could be out of date or confusing in a few places. If you
have the time, I'd encourage you to start a new thread with any suggestions
you have or bugs/mistakes/etc. you find. I'm a new user myself also, but
have started contributing a bit.
-Ben
On Sunday, November 15, 2015 at 9:35:24 PM UTC+9, Chris Norman wrote:
>
> Hi,
> Thanks for the reply.
>
> I found the examples folder, but couldn't work out if the joystick.py
> file did anything.
>
> Anyways, while I was reading it occured to me that maybe I had to do
> joystick.event, rather than window.event.
>
> That actually worked perfectly, but that wasn't clear from the
> documentation (assuming I'm right). Should the documentation be updated?
> Or is it blatently obvious and I just missed it?
>
> The following code runs and works:
>
> import pyglet
> from accessible_output2.outputs.auto import Auto
>
> ao2 = Auto()
>
> window = pyglet.window.Window()
>
> for j in pyglet.input.get_joysticks():
> j.open()
> @j.event
> def on_joybutton_press(joystick, button):
> ao2.speak('Button %s.' % button)
>
> pyglet.app.run()
>
> Cheers,
>
>
> On 15/11/2015 06:13, Benjamin Moran wrote:
> > Hi Chris,
> >
> > The way joysticks are implemented in pyglet, the event system handles
> updating the button/axis values. For that reason you won't get any values
> if you tried testing it in an interactive Python shell, for example.
> >
> > First of all, could you try the joystick test app? It can be found in
> the Bitbucket source, in the examples folder I think. It's named
> joystick.py.
> >
> > If that doesn't work, could you give some additional details on your
> environment? OS, pyglet version, Python version, etc.
> >
> > -Ben
> >
>
>
--
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.