Skip to content

Instantly share code, notes, and snippets.

@kived
Last active August 29, 2015 14:12
Show Gist options
  • Save kived/5fe6bf4a82995654037a to your computer and use it in GitHub Desktop.
Save kived/5fe6bf4a82995654037a to your computer and use it in GitHub Desktop.
Kivy: TextInput focus selection
import kivy
kivy.require('1.8.1')
from kivy.app import App
from kivy.lang import Builder
from kivy.clock import Clock
root = Builder.load_string('''
#:import Clock kivy.clock.Clock
FloatLayout:
TextInput:
id: ti
size_hint: None, None
size: 100, 100
pos: 100, 100
text: 'asdgasg'
on_focused: self.focused and Clock.schedule_once(lambda dt: self.select_all())
''')
class TestApp(App):
def build(self):
return root
if __name__ == '__main__':
TestApp().run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment