Open In App

Hello World in Kivy

Kivy is an opensource multi-platform GUI development library for Python and can run on iOS, Android, Windows, OS X, and GNU/Linux. It helps develop applications that make use of innovative, multi-touch UI. The fundamental idea behind Kivy is to enable the developer to build an app once and use it across all devices, making the code reusable and deployable, allowing for quick and easy interaction design and rapid prototyping.

Note: Since Kivy is based in Python, Python is a prerequisite before installing Kivy. For more information, refer to Python Programming Language.



Installation

There are several ways to get Kivy installed in your system, depending upon your Operating System. Let’s dive into it.
Windows OS

Linux



OS X

Hello World in Kivy

Complete Program




import kivy
from kivy.app import App
from kivy.uix.label import Label
  
  
# Replace this with your 
# current version
kivy.require('1.11.1')  
  
# Defining a class
class MyFirstKivyApp(App):
      
    # Function that returns 
    # the root widget
    def build(self):
          
        # Label with text Hello World is 
        # returned as root widget
        return Label(text ="Hello World !")          
  
  
# Here our class is initialized
# and its run() method is called. 
# This initializes and starts 
# our Kivy application.
MyFirstKivyApp().run()               

Output:

Article Tags :