Dropdown Item

https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/dropdown-item.png

Usage

from kivy.lang import Builder

from kivymd.app import MDApp

KV = '''
Screen

    MDDropDownItem:
        id: drop_item
        pos_hint: {'center_x': .5, 'center_y': .5}
        text: 'Item'
        on_release: self.set_item("New Item")
'''


class Test(MDApp):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.screen = Builder.load_string(KV)

    def build(self):
        return self.screen


Test().run()

API - kivymd.uix.dropdownitem

class kivymd.uix.dropdownitem.MDDropDownItem(**kwargs)

FakeRectangularElevationBehavio`r is a shadow mockup for widgets. Improves performance using cached images inside `kivymd.images dir

This class cast a fake Rectangular shadow behaind the widget.

You can either use this behavior to overwrite the elevation of a prefab widget, or use it directly inside a new widget class definition.

Use this class as follows for new widgets:

class NewWidget(
    ThemableBehavior,
    FakeCircularElevationBehavior,
    SpecificBackgroundColorBehavior,
    # here you add the other front end classes for the widget front_end,
):
    [...]

With this method each class can draw it’s content in the canvas in the correct order, avoiding some visual errors.

FakeCircularElevationBehavior will load prefabricated textures to optimize loading times.

Also, this class allows you to overwrite real time shadows, in the sence that if you are using a standard widget, like a button, MDCard or Toolbar, you can include this class after the base class to optimize the loading times.

As an example of this flexibility:

class Custom_rectangular_Card(
    MDCard,
    FakeRectangularElevationBehavior
):
    [...]

Note

About rounded corners: be careful, since this behavior is a mockup and will not draw any rounded corners.

text

Text item.

text is a StringProperty and defaults to ‘’.

current_item

Current name item.

current_item is a StringProperty and defaults to ‘’.

font_size

Item font size.

font_size is a NumericProperty and defaults to ’16sp’.

on_text(self, instance, value)
set_item(self, name_item)

Sets new text for an item.