Convert Figma logo to code with AI

kivy logokivy

Open source UI framework written in Python, running on Windows, Linux, macOS, Android and iOS

17,941
3,085
17,941
843

Top Related Projects

4,407

A Python native, OS native GUI toolkit.

Python GUIs for Humans! PySimpleGUI is the top-rated Python application development environment. Launched in 2018 and actively developed, maintained, and supported in 2024. Transforms tkinter, Qt, WxPython, and Remi into a simple, intuitive, and fun experience for both hobbyists and expert users.

2,346

wxPython's Project Phoenix. A new implementation of wxPython, better, stronger, faster than he was before.

11,752

Flet enables developers to easily build realtime web, mobile and desktop apps in Python. No frontend experience required.

Quick Overview

Kivy is an open-source Python library for developing cross-platform applications with natural user interfaces. It provides a powerful framework for creating rich, interactive applications that can run on various platforms including Windows, macOS, Linux, iOS, and Android, using a single codebase.

Pros

  • Cross-platform compatibility, allowing developers to write code once and deploy on multiple platforms
  • Rich set of UI elements and widgets for creating visually appealing interfaces
  • Strong community support and active development
  • Supports multi-touch events, making it suitable for mobile and tablet applications

Cons

  • Steeper learning curve compared to some other Python GUI frameworks
  • Limited native look and feel, as Kivy uses its own graphics engine
  • Larger application size compared to native applications
  • Performance can be slower than native applications for complex interfaces

Code Examples

  1. Creating a simple "Hello World" application:
from kivy.app import App
from kivy.uix.label import Label

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

if __name__ == '__main__':
    HelloWorldApp().run()
  1. Creating a button with an event handler:
from kivy.app import App
from kivy.uix.button import Button

class ButtonApp(App):
    def build(self):
        return Button(text='Press Me!', on_press=self.on_button_press)

    def on_button_press(self, instance):
        print('Button pressed!')

if __name__ == '__main__':
    ButtonApp().run()
  1. Using Kivy Language (kv) for UI design:
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout

class MyApp(App):
    def build(self):
        return BoxLayout()

if __name__ == '__main__':
    MyApp().run()
# my.kv
<BoxLayout>:
    orientation: 'vertical'
    Button:
        text: 'Button 1'
    Button:
        text: 'Button 2'
    Label:
        text: 'Hello, Kivy!'

Getting Started

To get started with Kivy:

  1. Install Kivy:

    pip install kivy
    
  2. Create a new Python file (e.g., main.py) and import Kivy:

    from kivy.app import App
    from kivy.uix.label import Label
    
    class MyApp(App):
        def build(self):
            return Label(text='Hello, Kivy!')
    
    if __name__ == '__main__':
        MyApp().run()
    
  3. Run the application:

    python main.py
    

This will launch a simple Kivy application with a "Hello, Kivy!" label.

Competitor Comparisons

4,407

A Python native, OS native GUI toolkit.

Pros of Toga

  • Native look and feel on each platform
  • Smaller learning curve for developers familiar with traditional GUI frameworks
  • Better integration with platform-specific features and APIs

Cons of Toga

  • Less mature and fewer features compared to Kivy
  • Smaller community and ecosystem
  • Limited support for custom widgets and advanced graphics

Code Comparison

Kivy example:

from kivy.app import App
from kivy.uix.button import Button

class MyApp(App):
    def build(self):
        return Button(text='Hello World')

MyApp().run()

Toga example:

import toga

def button_handler(widget):
    print("Hello World")

def build(app):
    box = toga.Box()
    button = toga.Button('Hello World', on_press=button_handler)
    box.add(button)
    return box

def main():
    return toga.App('First App', 'org.example.first', startup=build)

if __name__ == '__main__':
    main().main_loop()

Both frameworks allow for creating simple GUI applications, but Toga's code structure is more similar to traditional desktop GUI frameworks, while Kivy uses a unique approach with its own widget system and properties.

Python GUIs for Humans! PySimpleGUI is the top-rated Python application development environment. Launched in 2018 and actively developed, maintained, and supported in 2024. Transforms tkinter, Qt, WxPython, and Remi into a simple, intuitive, and fun experience for both hobbyists and expert users.

Pros of PySimpleGUI

  • Simpler and more intuitive API for beginners
  • Faster development for small to medium-sized applications
  • Supports multiple GUI frameworks (tkinter, Qt, WxPython, Remi)

Cons of PySimpleGUI

  • Less flexible for complex, custom UI designs
  • Limited support for mobile platforms
  • Smaller community and ecosystem compared to Kivy

Code Comparison

PySimpleGUI:

import PySimpleGUI as sg

layout = [[sg.Text("Hello World")], [sg.Button("OK")]]
window = sg.Window("Demo", layout)
event, values = window.read()
window.close()

Kivy:

from kivy.app import App
from kivy.uix.button import Button

class MyApp(App):
    def build(self):
        return Button(text='Hello World')

MyApp().run()

PySimpleGUI offers a more straightforward approach for creating simple GUIs, while Kivy provides a more powerful and flexible framework for developing cross-platform applications, especially for mobile devices. PySimpleGUI is better suited for rapid prototyping and small desktop applications, whereas Kivy excels in creating complex, customizable UIs and mobile apps.

2,346

wxPython's Project Phoenix. A new implementation of wxPython, better, stronger, faster than he was before.

Pros of Phoenix

  • Native look and feel on different platforms
  • Extensive set of UI controls and widgets
  • Strong support for desktop applications

Cons of Phoenix

  • Steeper learning curve
  • Less suitable for mobile development
  • Larger application size compared to Kivy

Code Comparison

Phoenix:

import wx

app = wx.App()
frame = wx.Frame(None, title="Hello World")
frame.Show()
app.MainLoop()

Kivy:

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

class HelloApp(App):
    def build(self):
        return Label(text="Hello World")

HelloApp().run()

Summary

Phoenix is better suited for desktop applications with a native look, while Kivy excels in cross-platform and mobile development. Phoenix offers more built-in widgets, but Kivy provides a more flexible and customizable UI system. The choice between the two depends on the specific requirements of your project, target platforms, and desired user interface style.

11,752

Flet enables developers to easily build realtime web, mobile and desktop apps in Python. No frontend experience required.

Pros of Flet

  • Simpler syntax and easier learning curve for Python developers
  • Built-in responsive design and mobile support
  • Faster development of cross-platform applications

Cons of Flet

  • Less mature and smaller community compared to Kivy
  • Limited customization options for complex UI designs
  • Fewer third-party extensions and libraries available

Code Comparison

Flet example:

import flet as ft

def main(page: ft.Page):
    page.add(ft.Text("Hello, World!"))

ft.app(target=main)

Kivy example:

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

class MyApp(App):
    def build(self):
        return Label(text='Hello, World!')

MyApp().run()

Both Flet and Kivy are Python frameworks for building cross-platform applications, but they have different approaches. Flet focuses on simplicity and rapid development, while Kivy offers more flexibility and control over the UI. Flet uses a more Pythonic syntax, making it easier for Python developers to get started, whereas Kivy has a steeper learning curve but provides more customization options for complex applications.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Kivy

Kivy is an open-source Python framework for developing GUI apps that work cross-platform, including desktop, mobile and embedded platforms.

The aim is to allow for quick and easy interaction design and rapid prototyping whilst making your code reusable and deployable: Innovative user interfaces made easy.

Kivy is written in Python and Cython and is built on OpenGL ES 2.0. It supports various input devices and has an extensive (and extensible) widget library. With the same codebase, you can target Windows, macOS, Linux (including Raspberry Pi OS), Android, and iOS. All Kivy widgets are built with multitouch support.

Kivy is MIT licensed, actively developed by a great community and is supported by many projects managed by the Kivy Organization.

Backers on Open Collective Sponsors on Open Collective Contributor Covenant GitHub contributors

PyPI - Version PyPI - Python Version

Windows Unittests Status Ubuntu Unittests Status OSX Unittests Status Coverage Status

Windows wheels Status Manylinux wheels Status Raspberry Pi wheels Status OSX wheels Status

Installation, Documentation and Examples

Extensive installation instructions as well as tutorials and general documentation, including an API reference, can be found at https://www.kivy.org/docs. A PDF version is also available.

Kivy ships with many examples which can be found in the examples folder.

Support

Are you having trouble using the Kivy framework, or any of its related projects? Is there an error you don’t understand? Are you trying to figure out how to use it? We have volunteers who can help!

The best channels to contact us for support are listed in the latest Contact Us document.

Contributing

We love pull requests and discussing novel ideas. Check out our latest contribution guide and feel free to improve Kivy.

It gives details of the best places online to discuss the development with the core developers and other enthusiasts.

Sibling projects

The Kivy team manager a number of additional projects that support the Kivy eco-system.

  • Buildozer: a development tool for turning Python applications into binary packages ready for installation on any of a number of platforms, including mobile devices.
  • Plyer: a platform-independent Python API for accessing hardware features of various platforms (Android, iOS, macOS, Linux and Windows).
  • PyJNIus: a Python library for accessing Java classes using the Java Native Interface (JNI).
  • Pyobjus: Python module for accessing Objective-C classes as Python classes using Objective-C runtime reflection.
  • Python for Android: a development tool that packages Python apps into binaries that can run on Android devices.
  • Kivy iOS: a toolchain to compile the necessary libraries for iOS to run Kivy applications, and manage the creation of Xcode projects.
  • Audiostream: library for direct access to the microphone and speaker.
  • KivEnt: entity-based game engine for Kivy.
  • Oscpy: a Python implementation of Open Sound Control (OSC) network protocol.
  • Garden: widgets and libraries created and maintained by users.

Licenses

  • Kivy is released under the terms of the MIT License. Please refer to the LICENSE file.
  • The provided fonts Roboto and Roboto Mono are licensed and distributed under the terms of the Apache License, Version 2.0. The DejaVuSans (used for the virtual keyboard) license can be viewed here.
  • The current UI design has been adapted from Moblintouch theme's SVGs and is licensed under the terms of the LGPLv2.1.

Code of Conduct

In the interest of fostering an open and welcoming community, we as contributors and maintainers need to ensure participation in our project and our sister projects is a harassment-free and positive experience for everyone. It is vital that all interaction is conducted in a manner conveying respect, open-mindedness and gratitude.

Please consult the latest Code of Conduct.

Contributors

This project exists thanks to all the people who contribute. [Become a contributor].

Backers

Thank you to all of our backers! 🙏 [Become a backer]

Sponsors

Special thanks to all of our sponsors, past and present. Support this project by [becoming a sponsor].

Here are our top current sponsors. Please click through to see their websites, and support them as they support us.