Material App

This module contains MDApp class that is inherited from App. MDApp has some properties needed for KivyMD library (like theme_cls).

You can turn on the monitor displaying the current FPS value in your application:

KV = '''
Screen:

    MDLabel:
        text: "Hello, World!"
        halign: "center"
'''

from kivy.lang import Builder

from kivymd.app import MDApp


class MainApp(MDApp):
    def build(self):
        return Builder.load_string(KV)

    def on_start(self):
        self.fps_monitor_start()


MainApp().run()
https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/fps-monitor.png

API - kivymd.app

class kivymd.app.MDApp(**kwargs)

Application class, see module documentation for more information.

Events
on_start:

Fired when the application is being started (before the runTouchApp() call.

on_stop:

Fired when the application stops.

on_pause:

Fired when the application is paused by the OS.

on_resume:

Fired when the application is resumed from pause by the OS. Beware: you have no guarantee that this event will be fired after the on_pause event has been called.

Changed in version 1.7.0: Parameter kv_file added.

Changed in version 1.8.0: Parameters kv_file and kv_directory are now properties of App.

theme_cls

Instance of ThemeManager class.

Warning

The theme_cls attribute is already available in a class that is inherited from the MDApp class. The following code will result in an error!

class MainApp(MDApp):
    theme_cls = ThemeManager()
    theme_cls.primary_palette = "Teal"

Note

Correctly do as shown below!

class MainApp(MDApp):
    def build(self):
        self.theme_cls.primary_palette = "Teal"

theme_cls is an ObjectProperty.