Background Color¶
Note
The following classes are intended for in-house use of the library.
API - kivymd.uix.behaviors.backgroundcolorbehavior¶
-
class
kivymd.uix.behaviors.backgroundcolorbehavior.BackgroundColorBehavior(**kwargs)¶ Widget class. See module documentation for more information.
- Events
- on_touch_down: (touch, )
Fired when a new touch event occurs. touch is the touch object.
- on_touch_move: (touch, )
Fired when an existing touch moves. touch is the touch object.
- on_touch_up: (touch, )
Fired when an existing touch disappears. touch is the touch object.
- on_kv_post: (base_widget, )
Fired after all the kv rules associated with the widget and all other widgets that are in any of those rules have had all their kv rules applied. base_widget is the base-most widget whose instantiation triggered the kv rules (i.e. the widget instantiated from Python, e.g.
MyWidget()).Changed in version 1.11.0.
Warning
Adding a __del__ method to a class derived from Widget with Python prior to 3.4 will disable automatic garbage collection for instances of that class. This is because the Widget class creates reference cycles, thereby preventing garbage collection.
Changed in version 1.0.9: Everything related to event properties has been moved to the
EventDispatcher. Event properties can now be used when contructing a simple class without subclassingWidget.Changed in version 1.5.0: The constructor now accepts on_* arguments to automatically bind callbacks to properties or events, as in the Kv language.
-
r¶ The value of
redin thergbapalette.ris anBoundedNumericPropertyand defaults to 1.0.
-
g¶ The value of
greenin thergbapalette.gis anBoundedNumericPropertyand defaults to 1.0.
-
b¶ The value of
bluein thergbapalette.bis anBoundedNumericPropertyand defaults to 1.0.
-
a¶ The value of
alpha channelin thergbapalette.ais anBoundedNumericPropertyand defaults to 0.0.
-
radius¶ Canvas radius.
# Top left corner slice. MDBoxLayout: md_bg_color: app.theme_cls.primary_color radius: [25, 0, 0, 0]
radiusis anListPropertyand defaults to [0, 0, 0, 0].
-
md_bg_color¶ The background color of the widget (
Widget) that will be inherited from theBackgroundColorBehaviorclass.For example:
Widget: canvas: Color: rgba: 0, 1, 1, 1 Rectangle: size: self.size pos: self.pos
similar to code:
<MyWidget@BackgroundColorBehavior> md_bg_color: 0, 1, 1, 1
md_bg_coloris anReferenceListPropertyand defaults tor,g,b,a.
-
class
kivymd.uix.behaviors.backgroundcolorbehavior.SpecificBackgroundColorBehavior(**kwargs)¶ Widget class. See module documentation for more information.
- Events
- on_touch_down: (touch, )
Fired when a new touch event occurs. touch is the touch object.
- on_touch_move: (touch, )
Fired when an existing touch moves. touch is the touch object.
- on_touch_up: (touch, )
Fired when an existing touch disappears. touch is the touch object.
- on_kv_post: (base_widget, )
Fired after all the kv rules associated with the widget and all other widgets that are in any of those rules have had all their kv rules applied. base_widget is the base-most widget whose instantiation triggered the kv rules (i.e. the widget instantiated from Python, e.g.
MyWidget()).Changed in version 1.11.0.
Warning
Adding a __del__ method to a class derived from Widget with Python prior to 3.4 will disable automatic garbage collection for instances of that class. This is because the Widget class creates reference cycles, thereby preventing garbage collection.
Changed in version 1.0.9: Everything related to event properties has been moved to the
EventDispatcher. Event properties can now be used when contructing a simple class without subclassingWidget.Changed in version 1.5.0: The constructor now accepts on_* arguments to automatically bind callbacks to properties or events, as in the Kv language.
-
background_palette¶ See
kivymd.color_definitions.palette.background_paletteis anOptionPropertyand defaults to ‘Primary’.
-
background_hue¶ See
kivymd.color_definitions.hue.background_hueis anOptionPropertyand defaults to ‘500’.
-
specific_text_color¶ specific_text_coloris anListPropertyand defaults to [0, 0, 0, 0.87].
-
specific_secondary_text_color¶ specific_secondary_text_color`is an :class:`~kivy.properties.ListPropertyand defaults to [0, 0, 0, 0.87].