Convert Figma logo to code with AI

kivymd logoKivyMD

KivyMD is a collection of Material Design compliant widgets for use with Kivy, a framework for cross-platform, touch-enabled graphical applications. https://youtube.com/c/KivyMD https://twitter.com/KivyMD https://habr.com/ru/users/kivymd https://stackoverflow.com/tags/kivymd

2,265
680
2,265
149

Top Related Projects

17,941

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

11,752

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

3,282

Write desktop and web apps in pure Python

2,346

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

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.

Quick Overview

KivyMD is an open-source collection of Material Design compliant widgets for use with Kivy, a popular Python framework for developing cross-platform applications. It allows developers to create beautiful, modern-looking user interfaces that adhere to Google's Material Design guidelines while leveraging the power and flexibility of Kivy.

Pros

  • Provides a wide range of pre-built Material Design widgets
  • Enables rapid development of visually appealing cross-platform applications
  • Integrates seamlessly with existing Kivy projects
  • Actively maintained with regular updates and improvements

Cons

  • Learning curve can be steep for those new to Kivy
  • Documentation can be incomplete or outdated in some areas
  • Some widgets may have limited customization options
  • Performance can be slower compared to native UI frameworks

Code Examples

  1. Creating a basic KivyMD app with a toolbar:
from kivymd.app import MDApp
from kivymd.uix.screen import MDScreen
from kivymd.uix.toolbar import MDTopAppBar

class MyApp(MDApp):
    def build(self):
        screen = MDScreen()
        toolbar = MDTopAppBar(title="My KivyMD App")
        screen.add_widget(toolbar)
        return screen

MyApp().run()
  1. Adding a button with an icon:
from kivymd.uix.button import MDRaisedButton
from kivymd.uix.screen import MDScreen

class MyScreen(MDScreen):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        button = MDRaisedButton(
            text="Click me",
            icon="language-python",
            pos_hint={"center_x": 0.5, "center_y": 0.5}
        )
        self.add_widget(button)
  1. Creating a simple list with icons:
from kivymd.uix.list import MDList, OneLineIconListItem
from kivymd.uix.scrollview import MDScrollView
from kivymd.icon_definitions import md_icons

class MyList(MDScrollView):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        list_view = MDList()
        for icon in list(md_icons.keys())[:20]:
            list_view.add_widget(
                OneLineIconListItem(text=icon, icon=icon)
            )
        self.add_widget(list_view)

Getting Started

To get started with KivyMD:

  1. Install KivyMD using pip:

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

    from kivymd.app import MDApp
    from kivymd.uix.screen import MDScreen
    from kivymd.uix.button import MDRaisedButton
    
    class MyApp(MDApp):
        def build(self):
            screen = MDScreen()
            button = MDRaisedButton(text="Hello, KivyMD!", pos_hint={"center_x": 0.5, "center_y": 0.5})
            screen.add_widget(button)
            return screen
    
    MyApp().run()
    
  3. Run the script:

    python main.py
    

This will create a simple KivyMD app with a button in the center of the screen.

Competitor Comparisons

17,941

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

Pros of Kivy

  • More mature and established project with a larger community
  • Supports multiple platforms including desktop, mobile, and web
  • Offers greater flexibility and customization options

Cons of Kivy

  • Steeper learning curve for beginners
  • Less modern and material design-focused UI components
  • Requires more code to achieve a polished, modern look

Code Comparison

KivyMD:

from kivymd.app import MDApp
from kivymd.uix.button import MDRaisedButton

class MyApp(MDApp):
    def build(self):
        return MDRaisedButton(text="Hello, World!")

Kivy:

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

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

Summary

KivyMD is built on top of Kivy and provides a more modern, material design-focused set of UI components. It's easier for beginners to create visually appealing apps quickly. However, Kivy offers more flexibility and platform support, making it suitable for a wider range of projects. The choice between the two depends on the specific requirements of your project and your familiarity with Python GUI development.

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 beginners
  • Cross-platform support for web, desktop, and mobile with a single codebase
  • Built-in state management and real-time updates

Cons of Flet

  • Less mature and smaller community compared to KivyMD
  • Fewer pre-built widgets and customization options
  • Limited documentation and learning resources

Code Comparison

KivyMD example:

from kivymd.app import MDApp
from kivymd.uix.button import MDRaisedButton

class MyApp(MDApp):
    def build(self):
        return MDRaisedButton(text="Hello, World!")

MyApp().run()

Flet example:

import flet as ft

def main(page: ft.Page):
    page.add(ft.ElevatedButton(text="Hello, World!"))

ft.app(target=main)

Both frameworks aim to simplify UI development, but Flet's syntax is more concise and Pythonic. KivyMD offers more advanced customization options, while Flet focuses on simplicity and cross-platform compatibility. The choice between the two depends on project requirements, target platforms, and developer preferences.

3,282

Write desktop and web apps in pure Python

Pros of Flexx

  • Uses web technologies (HTML, CSS, JavaScript) for UI, allowing for easier cross-platform development
  • Supports both desktop and web applications from a single codebase
  • Offers a reactive programming model for more intuitive state management

Cons of Flexx

  • Smaller community and fewer resources compared to KivyMD
  • Less mature and may have fewer pre-built widgets and components
  • Steeper learning curve for developers not familiar with web technologies

Code Comparison

KivyMD example:

from kivymd.app import MDApp
from kivymd.uix.button import MDRaisedButton

class MyApp(MDApp):
    def build(self):
        return MDRaisedButton(text="Hello, World!")

MyApp().run()

Flexx example:

from flexx import flx

class MyApp(flx.Widget):
    def init(self):
        flx.Button(text='Hello, World!')

if __name__ == '__main__':
    app = flx.App(MyApp)
    app.launch('browser')
    flx.run()

Both KivyMD and Flexx offer unique approaches to building user interfaces in Python. KivyMD focuses on mobile-first design with Material Design components, while Flexx leverages web technologies for cross-platform development. The choice between them depends on the specific project requirements and developer preferences.

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 across platforms
  • Extensive widget set and mature ecosystem
  • Strong support for desktop applications

Cons of Phoenix

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

Code Comparison

KivyMD example:

from kivymd.app import MDApp
from kivymd.uix.button import MDRaisedButton

class MyApp(MDApp):
    def build(self):
        return MDRaisedButton(text="Hello, World!")

MyApp().run()

Phoenix example:

import wx

app = wx.App()
frame = wx.Frame(None, title="Hello World")
btn = wx.Button(frame, label="Click Me")
frame.Show()
app.MainLoop()

KivyMD focuses on material design and is more suitable for cross-platform mobile development, while Phoenix (wxWidgets) excels in creating native-looking desktop applications. KivyMD offers a more modern and visually appealing interface out of the box, but Phoenix provides greater flexibility and control over UI elements.

KivyMD has a gentler learning curve and is Python-centric, making it easier for beginners. Phoenix, being a wrapper for wxWidgets, requires understanding of both Python and wxWidgets concepts, which can be more challenging for newcomers.

Both frameworks have active communities and ongoing development, but Phoenix benefits from the long-standing wxWidgets ecosystem, offering a wider range of widgets and tools for complex desktop applications.

4,407

A Python native, OS native GUI toolkit.

Pros of Toga

  • Native look and feel across platforms (iOS, Android, Windows, macOS, Linux)
  • Supports a wider range of platforms than KivyMD
  • Integrates well with other BeeWare tools for a complete development ecosystem

Cons of Toga

  • Smaller community and fewer resources compared to KivyMD
  • Less mature and may have fewer widgets/components available
  • Steeper learning curve for developers new to BeeWare ecosystem

Code Comparison

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

if __name__ == '__main__':
    app = toga.App('First App', 'org.example.first', startup=build)
    app.main_loop()

KivyMD example:

from kivymd.app import MDApp
from kivymd.uix.screen import MDScreen
from kivymd.uix.button import MDRaisedButton

class MainApp(MDApp):
    def build(self):
        screen = MDScreen()
        button = MDRaisedButton(text="Hello World", pos_hint={'center_x': 0.5, 'center_y': 0.5})
        screen.add_widget(button)
        return screen

MainApp().run()

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 syntax and easier to learn for beginners
  • Supports multiple GUI frameworks (tkinter, Qt, WxPython, Remi)
  • Extensive documentation and examples

Cons of PySimpleGUI

  • Less customizable and feature-rich compared to KivyMD
  • Limited support for mobile platforms
  • May not be suitable for complex, large-scale applications

Code Comparison

PySimpleGUI:

import PySimpleGUI as sg

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

KivyMD:

from kivymd.app import MDApp
from kivymd.uix.screen import MDScreen
from kivymd.uix.button import MDRaisedButton

class MainApp(MDApp):
    def build(self):
        screen = MDScreen()
        screen.add_widget(MDRaisedButton(text="Hello World", pos_hint={"center_x": 0.5, "center_y": 0.5}))
        return screen

MainApp().run()

PySimpleGUI offers a more concise and straightforward approach, while KivyMD provides greater flexibility and control over the UI elements. KivyMD is better suited for creating modern, material design-inspired interfaces, especially for mobile applications. PySimpleGUI excels in rapid prototyping and simple desktop 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

KivyMD 2.0.0

KivyMD is a collection of Material Design compliant widgets for use with Kivy, a framework for cross-platform, touch-enabled graphical applications.

The project's goal is to approximate Google's Material Design spec as close as possible without sacrificing ease of use. This library is a fork of the KivyMD project. We found the strength and brought this project to a new level.

Join the project! Just fork the project, branch out and submit a pull request when your patch is ready. If any changes are necessary, we'll guide you through the steps that need to be done via PR comments or access to your for may be requested to outright submit them.

If you wish to become a project developer (permission to create branches on the project without forking for easier collaboration), have at least one PR approved and ask for it. If you contribute regularly to the project the role may be offered to you without asking too.

PyPI version Supported Python versions Downloads Code style: Black

Discord Twitter YouTube Habr StackOverflow Open Collective

Coverage status Build workflow Test workflow Documentation status Repository size

Installation

pip install kivymd==2.0.0

Dependencies:

How to install

Command above will install latest release version of KivyMD from PyPI.

If you want to install development version from master branch, you should specify link to zip archive:

pip install https://github.com/kivymd/KivyMD/archive/master.zip

Tip: Replace master.zip with <commit hash>.zip (eg 51b8ef0.zip) to download KivyMD from specific commit.

Also you can install manually from sources. Just clone the project and run pip:

git clone https://github.com/kivymd/KivyMD.git --depth 1
cd KivyMD
pip install .

Speed Tip: If you don't need full commit history (about 1.14 GiB), you can use a shallow clone (git clone https://github.com/kivymd/KivyMD.git --depth 1) to save time. If you need full commit history, then remove --depth 1.

How to use with Buildozer

requirements = python3,
    kivy,
    https://github.com/kivymd/KivyMD/archive/master.zip,
    materialyoucolor,
    exceptiongroup,
    asyncgui,
    asynckivy

This will download latest release version of KivyMD from PyPI.

If you want to use development version from master branch, you should specify link to zip archive:

requirements = kivy, https://github.com/kivymd/KivyMD/archive/master.zip

Do not forget to run buildozer android clean or remove .buildozer directory before building if version was updated (Buildozer doesn't update already downloaded packages).

On Linux

On Windows 10

Build automatically via GitHub Actions

How to use with kivy-ios

toolchain build python3 kivy pillow
toolchain pip install --no-deps kivymd

Documentation

Demos

Kitchen sink app demonstrates every KivyMD widget. You can see how to use widget in code of app.

Comparison of Flutter & KivyMD

Sky View ConceptHealthy Food Delivery
Asics Shoes ConceptFacebook Desktop Redesign

Use MVC and Hot Reload

Support

If you need assistance or you have a question, you can ask for help on our mailing list:

Settings

Syntax highlighting and auto-completion for Kivy/KivyMD .kv files in PyCharm/Intellij IDEA

Promo Video

Contributing

We always welcome your Bug reports, Feature requests and Pull requests! Check out CONTRIBUTING.md and feel free to improve KivyMD.

Setup environment

We recommend you to use PyCharm to work with KivyMD code. Install Kivy and development dependencies to your virtual environment:

pip install -e .[dev,docs]
pre-commit install

Format all files and run tests:

pre-commit run --all-files
pytest kivymd/tests --timeout=600 --cov=kivymd --cov-report=term

pre-commit will format modified files with Black and sort imports with isort.

Sister projects

KivyMD Extensions

Additional extensions for the KivyMD library.

https://github.com/kivymd-extensions

KivyMDBuilder

Build apps visually.

https://github.com/kivymd/KivyMDBuilder

License

Contributors

KivyMD Team

They spent a lot of time to improve KivyMD.

  • Yuri Ivanov @HeaTTheatR - Core developer
  • Artem Bulgakov @ArtemSBulgakov - Technical administrator, contributor
  • Andrés Rodríguez @mixedCase - First author of KivyMD project, contributor

Code Contributors

This project exists thanks to all the people who contribute. How to contribute

Financial Contributors

Become a financial contributor on OpenCollective and help us sustain our community.

Gold Sponsors

Become a Gold Sponsor and get your logo on our Readme with a link to your website.

Best Route Planner
Best Route Planner - Route Optimization Software

Backers

Become a Backer if you want to help develop this project.