Created
May 15, 2018 14:17
-
-
Save dolang/ebc679311f84c85127e53c1418c1d3a9 to your computer and use it in GitHub Desktop.
Kivy ActionBar with TextInput example.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Kivy App. | |
""" | |
import kivy | |
kivy.require('1.10.0') | |
from kivy.app import App | |
from kivy.lang import Builder | |
from kivy.uix.actionbar import ActionItem | |
from kivy.uix.textinput import TextInput | |
KV = '''\ | |
ActionBar: | |
ActionView: | |
ActionPrevious: | |
ActionButton: | |
text: "This Button doesn't do anything" | |
''' | |
class ActionText(TextInput, ActionItem): | |
def __init__(self, **kwargs): | |
super(ActionText, self).__init__(**kwargs) | |
self.multiline = False | |
def on_text_validate(self, *args): | |
print("Searching for " + self.text) | |
class MyApp(App): | |
def build(self): | |
root = Builder.load_string(KV) | |
root.action_view.add_widget(ActionText()) | |
return root | |
if __name__ == '__main__': | |
MyApp().run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment