Skip to content

Instantly share code, notes, and snippets.

@kiok46
kiok46 / Texture_Management_CustomCheckBoxes.py
Last active June 10, 2018 09:33
Texture management in Kivy using atlas
from kivy.uix.checkbox import CheckBox
class CustomCheckBox(CheckBox):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.background_down = 'atlas://textures/red-lightgrey/myatlas/button_pressed'
self.background_checkbox_normal = 'atlas://textures/red-lightgrey/myatlas/checkbox_off'
self.background_checkbox_down = 'atlas://textures/red-lightgrey/myatlas/checkbox_on'
self.background_checkbox_disabled_normal = 'atlas://textures/red-lightgrey/myatlas/checkbox_disabled_off'
@kiok46
kiok46 / CustomButtons.py
Created June 10, 2018 09:31
Texture management in Kivy using atlas
from kivy.uix.button import Button
class CustomButton(Button):
def __init__(self, **kwargs):
super().__init__(**kwargs)
# self.background_down = 'atlas://textures/red-lightgrey/myatlas/button_pressed'
self.background_normal = 'atlas://textures/red-lightgrey/myatlas/button_pressed'
@kiok46
kiok46 / Texture_Management_defaulttheme.atlas
Last active June 10, 2018 09:33
Texture management in Kivy using atlas
{"defaulttheme-0.png": {"progressbar_background": [391, 223, 24, 24], "tab_btn_disabled": [279, 127, 32, 32], "tab_btn_pressed": [381, 127, 32, 32], "image-missing": [249, 167, 48, 48], "splitter_h": [155, 113, 32, 7], "splitter_down": [501, 249, 7, 32], "splitter_disabled_down": [504, 127, 7, 32], "vkeyboard_key_down": [2, 34, 32, 32], "vkeyboard_disabled_key_down": [415, 127, 32, 32], "selector_right": [248, 219, 55, 62], "player-background": [2, 283, 103, 103], "selector_middle": [191, 219, 55, 62], "spinner": [235, 72, 29, 37], "tab_btn_disabled_pressed": [313, 127, 32, 32], "switch-button_disabled": [277, 287, 43, 32], "textinput_disabled_active": [372, 322, 64, 64], "splitter_grip": [499, 189, 12, 26], "vkeyboard_key_normal": [36, 34, 32, 32], "button_disabled": [80, 72, 29, 37], "media-playback-stop": [399, 167, 48, 48], "splitter": [501, 77, 7, 32], "splitter_down_h": [121, 113, 32, 7], "sliderh_background_disabled": [87, 122, 41, 37], "modalview-background": [2, 161, 45, 54], "button": [142, 72, 29,
@kiok46
kiok46 / modifiedNavigationDrawer.kv
Created June 10, 2018 08:53
Customizing your Navigation Drawer in Kivy & KivyMD
<NavigationDrawer>
...
BoxLayout:
size_hint: (1, .4)
NavDrawerToolbar:
padding: 10, 10
canvas.after:
Color:
rgba: (1, 1, 1, 1)
RoundedRectangle:
@kiok46
kiok46 / originalNavigationDrawer.kv
Created June 10, 2018 08:53
Customizing your Navigation Drawer in Kivy & KivyMD
<NavigationDrawer>
...
NavDrawerToolbar:
title: root.title
opposite_colors: False
title_theme_color: 'Secondary'
background_color: root.theme_cls.bg_light
elevation: 0
...
@kiok46
kiok46 / originalNavigationDrawer.py
Created June 10, 2018 08:52
Customizing your Navigation Drawer in Kivy & KivyMD
class NavigationDrawer(SlidingPanel, ThemableBehavior, ElevationBehavior):
title = StringProperty()
...
@kiok46
kiok46 / modifiedNavigationDrawer.py
Last active June 10, 2018 08:52
Customizing your Navigation Drawer in Kivy & KivyMD
class NavigationDrawer(SlidingPanel, ThemableBehavior, ElevationBehavior):
image_source = StringProperty()
...
@kiok46
kiok46 / navigationdrawer__init__.py
Created June 10, 2018 08:39
Customizing your Navigation Drawer in Kivy & KivyMD
# -*- coding: utf-8 -*-
from kivy.animation import Animation
from kivy.lang import Builder
from kivy.properties import StringProperty, ObjectProperty
from kivymd.elevationbehavior import ElevationBehavior
from kivymd.icon_definitions import md_icons
from kivymd.label import MDLabel
from kivymd.list import OneLineIconListItem, ILeftBody, BaseListItem
from kivymd.slidingpanel import SlidingPanel
from kivymd.theming import ThemableBehavior
@kiok46
kiok46 / kivymd_navigationdrawer.py
Created June 10, 2018 08:30
Customizing your Navigation Drawer in Kivy & KivyMD
# -*- coding: utf-8 -*-
from kivy.lang import Builder
from kivymd.label import MDLabel
from kivy.animation import Animation
from kivymd.slidingpanel import SlidingPanel
from kivymd.icon_definitions import md_icons
from kivymd.theming import ThemableBehavior
from kivymd.elevationbehavior import ElevationBehavior
from kivy.properties import StringProperty, ObjectProperty
from kivymd.list import OneLineIconListItem, ILeftBody, BaseListItem
@kiok46
kiok46 / Navigation_Drawer_main.py
Created June 10, 2018 08:28
Customizing your Navigation Drawer in Kivy & KivyMD
from kivy.app import App
from kivy.lang import Builder
from kivy.properties import ObjectProperty, StringProperty
from kivymd.theming import ThemeManager
from kivymd.navigationdrawer import NavigationDrawer
# from navigationdrawer import NavigationDrawer
main_widget_kv = '''
#:import Toolbar kivymd.toolbar.Toolbar