Guest User

Untitled

a guest
May 20th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. """
  2. Kivy App.
  3. """
  4.  
  5. import kivy
  6. kivy.require('1.10.0')
  7.  
  8. from kivy.app import App
  9. from kivy.lang import Builder
  10. from kivy.uix.actionbar import ActionItem
  11. from kivy.uix.textinput import TextInput
  12.  
  13.  
  14. KV = '''\
  15. ActionBar:
  16. ActionView:
  17. ActionPrevious:
  18. ActionButton:
  19. text: "This Button doesn't do anything"
  20. '''
  21.  
  22.  
  23. class ActionText(TextInput, ActionItem):
  24.  
  25. def __init__(self, **kwargs):
  26. super(ActionText, self).__init__(**kwargs)
  27. self.multiline = False
  28.  
  29. def on_text_validate(self, *args):
  30. print("Searching for " + self.text)
  31.  
  32.  
  33. class MyApp(App):
  34.  
  35. def build(self):
  36. root = Builder.load_string(KV)
  37. root.action_view.add_widget(ActionText())
  38. return root
  39.  
  40.  
  41. if __name__ == '__main__':
  42. MyApp().run()
Add Comment
Please, Sign In to add comment