Raw Key-events: Accepting Any Key

So, I’ve recently been advised to switch from standard key-events to raw key-events when handling control-mappings.

However, I find myself uncertain of something:

If I use “ButtonThrower.setButtonDownEvent” to catch all keys, and print out the result, what would be the output on an international keyboard?

That is, if someone with a relevant international keyboard were to run the following, and then press, say, “ě”, what would be the output?

from direct.showbase.ShowBase import ShowBase

class Game(ShowBase):
    def __init__(self):

        self.accept("escape", base.userExit)

        self.buttonThrower = base.buttonThrowers[0].node()
        self.accept("keyInterception", self.keyInterception)

    def keyInterception(self, key):
        print (key)

app = Game()

(I’ve tried setting the OS’s “input source” to various international layouts, but it doesn’t seem to affect the above, or the effect of a standard key-event. And since I’ve had a report of a key not working, that seems to suggest that while the “input source” affects things like ordinary typing, it doesn’t affect the key-events used by Panda.)

ě when pressed generates only raw- type event. So nothing will happen, there is nothing to intercept. You will need to use setRawButtonDownEvent. Then you will intercept “3” and it will print 3.

And to get the ě if you want to display it, do this:

map = base.win.get_keyboard_map()
label = map.get_mapped_button_label("3")

Aaah, I’d missed that method! Thank you! :slight_smile:

Yup, that much at least I got! Thank you nevertheless. :slight_smile: