from kivy.app import Appfrom kivy.core.window import Windowfrom kivy.lang import Builderfrom kivy.uix.gridlayout import GridLayoutfrom kivy.uix.screenmanager import Screen, ScreenManager
class MainGrid(GridLayout): pass
kv = Builder.load_string('''MainGrid:
<MainGrid>: size_hint: 1, 1 StackLayout: size_hint: 1,1 TextInput: size_hint: 1, 1 multiline: False''')
class TrialApp(App): def build(self): return kv
if __name__ == "__main__": TrialApp().run()
You can report this bug here: https://github.com/kivy/kivy/issues
Here are some possible work arounds:
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.textinput import TextInput
from kivy.properties import NumericProperty
kv = """
BoxLayout
orientation: 'vertical'
padding: 20
Label:
text: 'TextInput Test'
font_size: 40
BoxLayout:
size_hint_y: None
height: 48
Label:
text: 'No Padding'
TextInput:
size_hint: .8, None
pos_hint: {'center_x': .5}
height: '48'
font_size: 20
multiline: False
BoxLayout:
size_hint_y: None
height: 48
Label:
text: 'Padding'
TextInput:
size_hint: .8, None
pos_hint: {'center_x': .5}
height: '48'
font_size: 20
multiline: False
padding: 20, 10
BoxLayout:
size_hint_y: None
height: 48
Label:
text: 'Use a filter to limit characters'
CharLimitTextInput:
size_hint: .8, None
pos_hint: {'center_x': .5}
height: '48'
font_size: 20
multiline: False
max_characters: 10
input_filter: self.char_limit
Label:
"""
class CharLimitTextInput(TextInput):
max_characters = NumericProperty('20')
def char_limit(self, substring, undo):
if len(substring) + len(self.text) <= self.max_characters:
return substring
if len(substring) + len(self.text) > self.max_characters:
c = int(self.max_characters - len(self.text))
return substring[0:c]
class TrialApp(App):
def build(self):
return Builder.load_string(kv)
TrialApp().run()
--
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/50e25be9-3de6-44e3-bf48-12f6c0cb16a5o%40googlegroups.com.