有人知道如何在输入?
后将光标设置在kivy的第一行from kivy.app import App
from kivy.uix.textinput import TextInput
from kivy.uix.boxlayout import BoxLayout
class MyApp(App):
def build(self):
BoxPrincipal = BoxLayout(orientation = 'vertical')
self.textinput = TextInput(text='Hello world', multiline=False)
self.textinput.bind(on_text_validate=self.on_enter)
BoxPrincipal.add_widget(self.textinput)
return BoxPrincipal
def on_enter(self, instance):
print('User pressed enter in', instance)
print self.textinput.cursor_row
self.textinput.text = ""
self.textinput.focus = True
if __name__ == '__main__':
MyApp().run()
输入后,我需要在TextInput
的第一个中设置光标有人可以帮助我吗?