Search code examples
pythonsyntaxkivykivy-language

KIVY language: multiple commands in a single line


I have to do:

TextInput:
    on_text: something ; something_else

How can I perform this without getting errors in kv language?


Solution

  • You could just add more on_text bindings, line by line:

    TextInput:
        on_text: something
        on_text: something_else
    

    But I'd prefer binding custom function call, because I'm not sure order of execution is always the same with the above example. Something like this:

    MyTextInput:
        on_text: self.custom_function()
    

    and in python:

    class MyTextInput(TextInput):
        def custom_function(self):
            something()
            something_else()