BARRAUX Arthur
3 years ago
1 changed files with 30 additions and 0 deletions
@ -0,0 +1,30 @@ |
|||||
|
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() |
||||
|
|
Loading…
Reference in new issue