Select your language

Kivy makes it easy to to create a first running App. We'll be creating a classical "Hello World" program and display our greetings to the world.

Naming convention

Kivy has one main naming convention that you should stick with to make sure your program works properly once our apps will include more files. Always finish the name of your main file with the little word "App". Our app will get the name HelloWorld. Accordingly is the name of the Python file we create HelloWorldApp.py.

 

The Code

The mechanics of the code is simple. You need to have a class which inherits from kivy.app. To display the text, you have to return a label when the app calls the funtion build.

from kivy.app import App
from kivy.uix.label import Label

class HelloWorldApp(App):
    def build(self):
        label = Label(text = 'Hello World')
        return label

if __name__ == '__main__':
    HelloWorldApp().run()

The result is a beautiful greeting to the world

Next

The next tutorial will show you how to use Kivy widgets to add text dynamically on the press of a button.