How to REFOCUS in TextInut after reloading the next frame.

11 views
Skip to first unread message

Surendrababu Nallagorla

unread,
Jul 21, 2016, 1:26:04 AM7/21/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='' 
                                        on_press: Image_Input.focus=True 
''')

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