Basic App

Date: February 23rd 2016
Last updated: February 23rd 2016

At its basic level, kivy is a basic GUI that can be run from the terminal. This is example has been taken from the kivy tutorial docs and adapted here for quick reference.


import kivy
kivy.require('1.9.1') # replace with your current kivy 
# version (see below)
from import App
from kivy.uix.button import Button

# Define a class that inherits from App
class MyApp(App):
    # At a basic level you only need a build function
    def build(self):
        return Button(text='Hello World')

if __name__ == '__main__':
    # MyApp inherited run() from App
    # when this script is run as a main program from the terminal
    #   the following line will be called

Inspect version of kivy

# Run python3 in the terminal
# when you import kivy you will get some INFO...
import kivy

kivy screenshot

Run the kivy application

# run from the terminal

Note that the name "MyApp" that I defined as a class has been truncated to "My" for the title of the main window. This window is one big button which turns blue when its pressed/clicked on.

Screen shot of running

results matching ""

    No results matching ""