0

Simply put, I would like to use a small USB keypad/numpad to type into a text input field on a kivy app running on android via the kivy launcher.

I am using an OTG USB connector to connect a small keypad to my tablet. The connector works in general on the tablet (I can type in numbers in the browser and other apps). In a kivy app however, when I use the touchscreen to select a text input field, it focuses awaiting input, then if I try to type in with the numpad, nothing happens. After doing some testing with a normal sized USB keyboard, it works (but the numpad on it doesn't).

Here is the basic kivy app I used to test this out with:

from kivy.app import App
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager, Screen

KV = """

<MyScreenManager>:

    KeyboardInput:
        name: 'KeyInput'

<KeyboardInput>:
    GridLayout:
        rows: 3
        TextInput:
            id: input1
            text:''
            multiline: False        
        Widget:            
        TextInput:
            id: input2
            text:''
            multiline: False
"""

class KeyboardInput(Screen):
    pass


class MyScreenManager(ScreenManager):

    def changescreen(self, value):

        try:
            if value!='Go To...':
                self.current = value
        except:
            print('No screen named ' + value)

#Main application
class packagingDiscardmentApp(App):
    def build(self):
        Builder.load_string(KV)
        self.sm = MyScreenManager()
        return self.sm

if __name__ == '__main__':
    packagingDiscardmentApp().run()

My guess is that there is some issue with the ascii characters on the numpad and Kivy. Any help would be greatly appreciated.

ShaunBach
  • 31
  • 1
  • 4
  • do you have numlock on? it works fine with my kivy app (my numpad i mean) – Joran Beasley Apr 23 '18 at 17:11
  • I have tried it with numlock on and off, but it still gives me the same issue (on android). – ShaunBach Apr 23 '18 at 17:37
  • does it work on windows with a numpad? or whatever your dev environment is? I know ive done it without issue on both windows and linux with a standard keyboard that has a numpad on it ... I have not tried with android... but it doesnt make any sense that it would behave differently – Joran Beasley Apr 23 '18 at 17:39
  • The numpad works perfectly on windows (haven't tried linux), but for some reason, on android it doesn't work. – ShaunBach Apr 23 '18 at 17:45
  • oh ok :/ sorry then I wish i could be of more help :/ If it works in windows and not in anroid then i am at a loss (normal ascii works fine though? weird) – Joran Beasley Apr 23 '18 at 17:47
  • Yeah, if I plug a normal USB keyboard into the android tablet, then all the normal keys except the numpad work properly. No worries, thanks for trying, I appreciate it man. – ShaunBach Apr 23 '18 at 17:51

0 Answers0