Can I make a TextInput show the 'number' keyboard in Kivy when focused - with an iOS soft keyboard?

Viewed 188

On the homepage of my kivy iOS app, the user has to enter a word and a number into two seperate TextInput fields. I have been looking but haven't been able to find a way to get the iOS soft keyboard to display the 'numbers' keyboard when that particular TextInput field is focused.

I feel I am kind of on the right track but am doing it wrong. I have tried:

from kivy.uix.behaviors import FocusBehavior

def __init__(self, **kwargs):
    super(MainApp, self).__init__(**kwargs)
    FocusBehavior.input_type('numbers')

But I don't know how to implement this into my code so that it actually works. I don't want to have it set globally because most of the other TextInputs in the app are actually text.

I tried using it on my actual TextInput widget like so:

#:import FocusBehavior.input_type kivy.uix.behaviors

    TextInput:
        id: eta1
        markup: True
        input_type: 'number'  # here is where i'm attempting
        multiline: False
        font_size: '20sp'
        hint_text: "ETA 1 in UTC"
        opacity: 1 if self.text else .7
        padding_y: [self.height / 2.0 - (self.line_height / 2.0) * len(self._lines), 0]
        padding_x: [10, 0]
        text: self.text.upper() if self.text is not None else ''
        size_hint: .4, .08
        pos_hint: {"top": .775, "center_x": .71}

I've been going through Kivy docs here to try and understand how to use it, and i'm most likely way off. I've had a look on here as well and haven't found much on it either. One post seemed to think maybe it didn't work with iOS soft keyboards?? Is that true??

Please help me out as I'm very stuck.

0 Answers
Related