I am not able to REFOCUS TextInput after reload of my screen

16 views
Skip to first unread message

Surendrababu Nallagorla

unread,
Jul 19, 2016, 9:30:17 PM7/19/16
to Kivy users support
When I reload the screen, I am able to clear TextInut, but not able to REFOCUS, help me  to fix my following code?

from kivy.app import App
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager, Screen
Builder.load_string('''
<MainScreen>:
BoxLayout:
orientation: 'vertical'
BoxLayout:
BoxLayout:
TextInput:
id: Image_Input
multiline: False
focus: True
on_text_validate: Image_Input.focus=True
Button:
on_press:Image_Input.focus=True
text: 'RELOAD'
on_press: root.reload(); Image_Input.text='' 
''')

class MainScreen(Screen):
def reload(self):
print("screen reloaded")
pass
class TestApp(App):
    def build(self):
        # Create the screen manager
        screenManager = ScreenManager()
        screenManager.add_widget(MainScreen(name='main'))
        return screenManager

if __name__ == '__main__':
    TestApp().run()
Reply all
Reply to author
Forward
0 new messages