from kivy.factory import Factory
from kivy.uix.floatlayout import FloatLayout
class Root(FloatLayout):
def __init__(self, **kwargs) -> None:
super(Root, self).__init__(**kwargs)
def focus_first(self, _dt) -> None:
self.ids.one.focus = True
def validate(self, widget, value) -> None:
if widget == self.ids.one:
self.ids.one.text = value.capitalize()
self.ids.two.focus = True
if widget == self.ids.two:
self.ids.two.text = value.capitalize()
self.ids.one.focus = True
if widget == self.ids.three:
self.ids.three.text = value.capitalize()
def focused(self, widget) -> bool:
if not widget.focus:
self.validate(widget, widget.text)
return True
class Interface(App):
pass
Factory.register('Root', cls=Root)
if __name__ == '__main__':
Interface().run()