TextInput key_down event, stopPropagation

11 views
Skip to first unread message

Mac Simile

unread,
Sep 23, 2016, 12:32:52 PM9/23/16
to Kivy users support
Hi,

I'm new to kivy (and python for that matter), but a professional developer.

My question is:

What is the definitive way to completely consume a key in a key_down event handler of "TextInput" and derivatives ?

Like "stopPropagation" in javascript?

According to several parts of the documentation, it's supposed to be when you:

    return True

but that doesn't seem to cut it, and only works partially.  All alphanumeric + punctuations are still propagated.

Here's the simplest example I can think of:


class MyTextInput(TextInput):
    def keyboard_on_key_down(self, keyboard, keycode, text, modifiers):
          print keycode
          return True


This, should in theory, prevent any char actually reaching the parent TextInput itself, but only "interesting" chars (Esc, CR, BKSp etc,) are consumed.   All others still go through.

Is there a resolution to this?

In all my searches, I only found a vague reference by someone claiming that it was ok up to (1.9.0)

so, is this a 1.9.1 regression?

TIA
Reply all
Reply to author
Forward
0 new messages