You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
655 B
31 lines
655 B
3 years ago
|
from kivy.app import App
|
||
|
from kivy.graphics import Ellipse, Line
|
||
|
from kivy.uix.boxlayout import BoxLayout
|
||
|
from kivy.uix.textinput import TextInput
|
||
|
|
||
|
class CustomLayout(BoxLayout):
|
||
|
|
||
|
def __init__(self, **kwargs):
|
||
|
super(CustomLayout, self).__init__(**kwargs)
|
||
|
with self.canvas.after:
|
||
|
pass
|
||
|
self.textinput = TextInput(text='Hello world', multiline=False)
|
||
|
self.add_widget(self.textinput)
|
||
|
self.textinput.bind(on_text_validate=self.on_enter)
|
||
|
|
||
|
def on_enter(self,instance, value):
|
||
|
print('User pressed enter in', instance)
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
class MainApp(App):
|
||
|
|
||
|
def build(self):
|
||
|
root = CustomLayout()
|
||
|
return root
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
MainApp().run()
|
||
|
|