How to use the kivymd.uix.button.MDIconButton function in kivymd

To help you get started, we’ve selected a few kivymd examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github HeaTTheatR / KivyMD / kivymd / uix / useranimationcard.py View on Github external
def update_action_bar(self, action_bar, action_bar_items):
        action_bar.clear_widgets()
        new_width = 0
        for item in action_bar_items:
            new_width += dp(48)
            action_bar.add_widget(
                MDIconButton(
                    icon=item[0],
                    on_release=item[1],
                    opposite_colors=True,
                    text_color=self.specific_text_color,
                    theme_text_color="Custom",
                )
            )
        action_bar.width = new_width
github HeaTTheatR / KivyMD / kivymd / uix / picker.py View on Github external
MDIconButton:
                        size: dp(100), dp(100)
                        pos: self.pos
                        size_hint: (None, None)
                        canvas:
                            Color:
                                rgba: 0, 0, 0, 1
                            Ellipse:
                                size: self.size
                                pos: self.pos
                        on_release: app.theme_cls.theme_style = 'Dark'
"""
)


class ColorSelector(MDIconButton):
    color_name = OptionProperty("Indigo", options=palette)

    def rgb_hex(self, col):
        return get_color_from_hex(colors[col][self.theme_cls.accent_hue])


class MDThemePicker(
    ThemableBehavior,
    FloatLayout,
    ModalView,
    SpecificBackgroundColorBehavior,
    RectangularElevationBehavior,
):
    pass

github HeaTTheatR / KivyMD / kivymd / uix / chip.py View on Github external
md_choose_chip = self.parent
            if self.selected_chip_color:
                Animation(
                    color=self.theme_cls.primary_dark
                    if not self.selected_chip_color
                    else self.selected_chip_color,
                    d=0.3,
                ).start(self)
            if issubclass(md_choose_chip.__class__, MDChooseChip):
                for chip in md_choose_chip.children:
                    if chip is not self:
                        chip.color = self.theme_cls.primary_color
            if self.check:
                if not len(self.ids.box_check.children):
                    self.ids.box_check.add_widget(
                        MDIconButton(
                            icon="check",
                            size_hint_y=None,
                            height=dp(20),
                            disabled=True,
                            user_font_size=dp(20),
                            pos_hint={"center_y": 0.5},
                        )
                    )
                else:
                    check = self.ids.box_check.children[0]
                    self.ids.box_check.remove_widget(check)
            if self.callback:
                self.callback(self, self.label)
github HeaTTheatR / KivyMD / kivymd / uix / imagelist.py View on Github external
else:
            super().add_widget(widget, index, canvas)


class SmartTileWithLabel(SmartTile):
    _box_label = ObjectProperty()

    # MDLabel properties
    font_style = StringProperty("Caption")
    theme_text_color = StringProperty("Custom")
    tile_text_color = ListProperty([1, 1, 1, 1])
    text = StringProperty("")
    """Determines the text for the box footer/header"""


class Star(MDIconButton):
    def on_touch_down(self, touch):
        return True


class SmartTileWithStar(SmartTileWithLabel):
    stars = NumericProperty(1)

    def on_stars(self, *args):
        for star in range(self.stars):
            self.ids.box.add_widget(
                Star(
                    icon="star-outline",
                    theme_text_color="Custom",
                    text_color=[1, 1, 1, 1],
                )
            )
github HeaTTheatR / KivyMD / kivymd / uix / expansionpanel.py View on Github external
orientation: 'vertical'

        ExpansionPanel:
            id: item_anim
            title: root.title
            icon: root.icon
            on_press: root.check_open_box(self)
"""
)


class AvatarLeft(ILeftBody, Image):
    pass


class ChevronRight(IRightBodyTouch, MDIconButton):
    angle = NumericProperty(0)


class ExpansionPanel(OneLineAvatarIconListItem):
    title = StringProperty()
    icon = StringProperty()


class MDExpansionPanel(BoxLayout):
    content = ObjectProperty()
    icon = StringProperty()
    title = StringProperty()

    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.register_event_type("on_open")
github HeaTTheatR / KivyMD / kivymd / uix / toolbar.py View on Github external
def update_action_bar(self, action_bar, action_bar_items):
        action_bar.clear_widgets()
        new_width = 0
        for item in action_bar_items:
            new_width += dp(48)
            action_bar.add_widget(
                MDIconButton(
                    icon=item[0],
                    on_release=item[1],
                    opposite_colors=True,
                    text_color=self.specific_text_color,
                    theme_text_color="Custom",
                )
            )
        action_bar.width = new_width
github HeaTTheatR / KivyMD / kivymd / uix / list.py View on Github external
_txt_right_pad = NumericProperty(dp(40) + m_res.HORIZ_MARGINS)


class ImageLeftWidget(ILeftBody, Image):
    pass


class ImageRightWidget(IRightBodyTouch, Image):
    pass


class IconRightWidget(IRightBodyTouch, MDIconButton):
    pass


class IconLeftWidget(ILeftBodyTouch, MDIconButton):
    pass
github HeaTTheatR / KivyMD / kivymd / uix / card.py View on Github external
)
            self.ids.root_box.add_widget(card_post)
        # ---------------------------------------------------------------------
        if len(self.right_menu) and not self.with_image:
            self.ids.title_box.add_widget(
                MDIconButton(icon="dots-vertical", on_release=self.open_menu)
            )
        # ---------------------------------------------------------------------
        if self.likes_stars:
            box_likes_stars_right = AnchorLayout(
                anchor_x="right", size_hint_y=None, height=dp(30)
            )
            self.box_likes_stars = BoxLayout(spacing=(dp(5)))
            self.box_likes_stars.add_widget(Widget())
            for i in range(5):  # adding stars
                like_star = MDIconButton(
                    icon="star-outline",
                    size_hint=(None, None),
                    size=(dp(30), dp(30)),
                    id=str(i),
                    on_release=lambda x, y=i: self._update_likes_stars(y),
                )
                self.box_likes_stars.add_widget(like_star)
                self._list_instance_likes_stars.append(like_star)
            box_likes_stars_right.add_widget(self.box_likes_stars)
            self.ids.root_box.remove_widget(self.ids.sep)
            self.add_widget(box_likes_stars_right)