Carbon Design App

The CarbonApp class inherits from App and CarbonTheme to define and update the theme and appropriate colors based on the given theme.

Overview

../../_images/carbondesignexamples.svg

Carbon Kivy Examples Overview

Minimal Example

Below is an example code of a basic CarbonKivy application.

from kivy.lang import Builder

from carbonkivy.app import CarbonApp
from carbonkivy.uix.screen import CScreen

class MyApp(CarbonApp):

    def __init__(self, **kwargs):
        super(MyApp, self).__init__(**kwargs)

    def build(self, *args) -> CScreen:
        self.kvlang = '''

CScreen:

    CLabel:
        text: "Carbon Design System"
        font_size: plex_18
        halign: "center"
        pos_hint: {"center_x" : 0.5, "center_y" : 0.6}

    CButtonPrimary:
        text: "Primary Button"
        role: "Large Productive"
        pos_hint: {"center_x" : 0.5, "center_y" : 0.4}
        on_press:
            self.icon = "add"

        '''
        return Builder.load_string(self.kvlang)

if __name__ == "__main__":
    app = MyApp()
    app.run()

API

class carbonkivy.app.CarbonApp(*args: Any, **kwargs: Any)[source]

Bases: App, CarbonTheme

The Main App class inherits from CarbonTheme to define and update the theme and appropriate colors based on the given theme.

load_all_kv_files(directory: str, *args) None[source]

Recursively load all kv files from a given directory.