To suppress propagation of an event you must return True from the
event handler. The KeyStateHandler doesn't do this as it was decided
it would be more useful to allow other systems to process the events
also - it just records the events happened. To have it also squash the
events you need to write your own version (copy the source from
pyglet.window.key) and have the on_ handlers return True.
Richard
On 22 August 2011 13:57, Lee <[email protected]> wrote:
> Hi all,
> I'm currently programming a task whereby people need to rotate a
> couple of bars around a centre circle, when done they press return.
> This then moves them on to the next stage whereby they adjust another
> image, using the same keys (right, left, up, down for adjustment,
> return when they are finished). I'm having a problem whereby the
> second stage is drawn momentarily, for one frame and then skipped
> over, returning back to the beginning of the program where the whole
> process is repeated again.
> It seems that this happens because the keypresses remain logged such
> that when the program moves on to the second stage it gets skipped
> over because the key.RETURN is logged as having been pressed. I
> confirmed this by changing the second stage as needing key.SPACE to be
> logged in order to move back to the top of the code.
>
> Just wondering if there is some way to have the key presses removed
> from wherever they are logged in pyglet, so that I can have people
> responding via the key.RETURN or whatever during both stages?
>
> I'm using
>
> keyState = pyglet.window.key.KeyStateHandler()
> mywin.winHandle.push_handlers(keyState)
>
> also, which was put into the code by somebody else who was working on
> the program, so I'm not quite sure what that's all about.
>
> Thank you very much in advance for any help that you are able to
> provide,
>
> Cheers,
> Lee :)
>
> --
> You received this message because you are subscribed to the Google Groups
> "pyglet-users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/pyglet-users?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pyglet-users?hl=en.