Looks like at least part of this has been addressed in a recent update to p4a: https://github.com/kivy/python-for-android/pull/2692
--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/131170b7-4d7c-47e4-9fb9-f09b0d89c2afn%40googlegroups.com.
You may find using input_filter simpler that overloading insert_text.
Assuming you wanted to only allow letter inputs, you could do as below:
from kivymd.app import MDApp
from kivymd.uix.button import MDFlatButton
from kivymd.uix.floatlayout import MDFloatLayout
from kivymd.uix.textfield import MDTextField
class Word(MDTextField):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.input_filter = self.letters_only
def letters_only(self, substring, from_undo):
if substring.isalpha():
return substring
class TestTextFieldApp(MDApp):
def btnOnRelease(self, instance):
if (self.word.keyboard_suggestions):
self.word.keyboard_suggestions = False
self.btn.text = "Turn on keyboard suggestions"
else:
self.btn.text = "Turn off keyboard suggestions"
self.word.keyboard_suggestions = True
def build(self):
self.root = MDFloatLayout()
self.word = Word()
self.word.input_type = "text"
self.root.add_widget(self.word)
self.word.pos_hint = {"center_x": 0.5, "center_y": 0.5}
self.word.size_hint = (0.75, 0.125)
self.btn = MDFlatButton()
self.btn.text = "Turn off keyboard suggestions"
self.btn.bind(on_release=self.btnOnRelease)
self.btn.pos_hint = {"center_x": 0.5, "center_y": 0.4}
self.btn.size_hint = (0.6, 0.125)
self.root.add_widget(self.btn)
return self.root
if __name__ == '__main__':
TestTextFieldApp().run()
From: Aravind R
Sent: Friday, December 2, 2022 11:02 PM
To: Kivy users support
Subject: [kivy-users] Text input behaves not expected when text is fromkeyboard suggestions and when paused and resumed backspace not working andkeyboard_suggestions not working
Hi Kivy support team,
--
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/638b797c.050a0220.756f7.c06dSMTPIN_ADDED_MISSING%40gmr-mx.google.com.
Robert – do you have any idea here?
I suggest removing the input filter and testing this again to make sure there is not an issue with the input filter. If the suggestion is trying to add a space, it will not be accepted by the filter.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CACY27vy07dhPzS4qAr7e9Kfk%2BQkSXnGtCe3e6Fn-QyvM6k3kvQ%40mail.gmail.com.
I suggest you look back at the GitHub issue link. If the solution at the link does not work – ask there. I have not done any android programing.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/2d7b6c45-b075-4469-8da5-c0d2b3869526n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/638f4ca5.050a0220.acb7d.a403SMTPIN_ADDED_MISSING%40gmr-mx.google.com.