Code Monkey home page Code Monkey logo

Comments (13)

rossant avatar rossant commented on May 17, 2024

Same on Windows 8 + AMD GPU.

from vispy.

almarklein avatar almarklein commented on May 17, 2024

Strange, for me it works fine. (Ubuntu Linux).

The docs seem pretty clear about this.
http://www.pyglet.org/doc/api/pyglet.window.Window-class.html#on_key_press
We just do text = chr(key) in vispy/app/backends/pyglet.py

Can either of you have a look at this?

from vispy.

rougier avatar rougier commented on May 17, 2024

on_key_press is really about keycode while one_text will give you the actual letter:

http://www.pyglet.org/doc/api/pyglet.window.Window-class.html#on_text

On Aug 8, 2013, at 2:06 PM, Almar Klein [email protected] wrote:

Strange, for me it works fine. (Ubuntu Linux).

The docs seem pretty clear about this.
http://www.pyglet.org/doc/api/pyglet.window.Window-class.html#on_key_press
We just do text = chr(key) in vispy/app/backends/pyglet.py

Can either of you have a look at this?


Reply to this email directly or view it on GitHub:
#11 (comment)

from vispy.

almarklein avatar almarklein commented on May 17, 2024

Arg. Pyglet keeps being annoying. Should we try to combine the two events somehow? This requires some thought. Perhaps @lcampagn has a good idea how to handle this?

from vispy.

campagnola avatar campagnola commented on May 17, 2024

As I've said, I don't think it is always necessary to cover up the differences between backends. The point of having a pyglet backend is to accomodate developers who prefer to work with pyglet, not to allow backend-independent applications. So to me, the most straightforward approach is to add an on_text event to the pyglet backend.

from vispy.

almarklein avatar almarklein commented on May 17, 2024

But then, would not two Key events being generated for most keys being pressed?

from vispy.

campagnola avatar campagnola commented on May 17, 2024

Yes, but they could be made distinguishable. Or, a KeyEvent and a TextEvent might be generated. It seems that is how pyglet is designed to be used..

from vispy.

almarklein avatar almarklein commented on May 17, 2024

Creating a TextEvent class just for pyglet goes a bit too far IMO.

from vispy.

rougier avatar rougier commented on May 17, 2024

I think GLFW is doing the same (but is it is called key and char).

On Aug 9, 2013, at 2:35 PM, Almar Klein [email protected] wrote:

Creating a TextEvent class just for pyglet goes a bit too far IMO.


Reply to this email directly or view it on GitHub:
#11 (comment)

from vispy.

almarklein avatar almarklein commented on May 17, 2024

I think most application would do fine if we simply make on_text generate a second KeyEvent:

If e.g. an arrow key is pressed, only one event is generated (the same that would be generated now)

If e.g. the "a" is pressed, at first the on_key_press is fired, but we will set its text attribute to an empty string. Then the second event (from on_text) will have the correct text attribute. The only situation (I think) where this goes wrong if a key event handler listens for character keys using event.key: for pyglet they would trigger twice.

from vispy.

almarklein avatar almarklein commented on May 17, 2024

I made a change to the pyglet backend:
1184c45

Let me know if this about fixes the problem.

from vispy.

rougier avatar rougier commented on May 17, 2024

Yep, works for me.

On Aug 12, 2013, at 10:51 AM, Almar Klein [email protected] wrote:

I made a change to the pyglet backend:
1184c45

Let me know if this about fixes the problem.


Reply to this email directly or view it on GitHub:
#11 (comment)

from vispy.

rossant avatar rossant commented on May 17, 2024

Works for me too.

from vispy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.