Hi all,

I've found a small but annoying feature or bug with Pyglet.


I'm pushing handlers on a class, to make a kind of menu structure. When I press enter on an item it loads a new menu. If the new menu contains one of my text fields (which listens for on_text), the enter key is sent to the text field too.


Here's a bare bones example:


import pyglet
pyglet.options['shadow_window'] = False

window = pyglet.window.Window(caption='PoC')


class Second:
    def on_text(self, text):
        """This should not happen until a second key is pressed."""
        print(text)
        window.close()


class First:
    def on_text(self, text):
        """I'd hope this would block Second.on_text."""
        print('Text %s here.' % text)
        return pyglet.event.EVENT_HANDLED

    def on_key_press(self, symbol, modifiers):
        """Should simply push the new handlers."""
        print('First here.')
        window.push_handlers(Second())
        return pyglet.event.EVENT_HANDLED


if __name__ == '__main__':
    window.push_handlers(First())
    pyglet.app.run()


What can O do to get around this short of using pyglet.clock.schedule_once for the pushes?


Cheers,


Chris

--
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 https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to