Skip to content

Instantly share code, notes, and snippets.

@cruor99
Created March 28, 2018 18:25
Show Gist options
  • Save cruor99/d004c70ecdc1adff3016a479b92c4be5 to your computer and use it in GitHub Desktop.
Save cruor99/d004c70ecdc1adff3016a479b92c4be5 to your computer and use it in GitHub Desktop.
from kivy.app import App
from kivy.uix.textinput import TextInput
from kivy.clock import Clock
class Test(App):
def build(self):
self.ti = TextInput()
self.ti.bind(text=self.format)
return self.ti
def format(self, *args):
text = self.ti.text
if text:
if text[-1] == 'A':
self.ti.text = text + '-'
Clock.schedule_once(self.move_cursor, 1)
def move_cursor(self, *args):
print("Moved Cursor")
self.ti.do_cursor_movement('cursor_right')
Test().run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment