How to use the kivymd.label.MDLabel 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 ellisonleao / pybrapp / screens / schedule.py View on Github external
# adding avatar widget
        if self.info['speaker'].get('avatar'):
            image = AsyncImage(source=self.info['speaker']['avatar'],
                               allow_stretch=True)
            box.add_widget(image)

        # adding place widget
        if self.info.get('place'):
            place = MDRaisedButton(text=self.info['place'], elevation_normal=2,
                                   opposite_colors=True,
                                   pos_hint={'center_x': .5, 'center_y': .4})
            box.add_widget(place)

        # adding description widget
        label = MDLabel(font_style='Body1', theme_text_color='Primary',
                        text=self._parse_text(), size_hint_y=None)
        label.bind(texture_size=label.setter('size'))

        box.add_widget(label)
        self.dialog = MDDialog(title=self.info['speaker']['name'],
                               content=box,
                               size_hint=(1, None),
                               height=dp(500),
                               auto_dismiss=False)

        self.dialog.add_action_button('Fechar',
                                      action=lambda *x: self.dialog.dismiss())
        self.dialog.open()
github Joelzeller / CoPilot / main.py View on Github external
def show_indev_dialog(self):
        content = MDLabel(font_style='Body1',
                          theme_text_color='Secondary',
                          text="This feature is currently in development.\n\n"
                               "Thanks for trying out CoPilot!  :)",
                          valign='top')

        content.bind(size=content.setter('text_size'))
        self.dialog = MDDialog(title="Coming soon!",
                               content=content,
                               size_hint=(.8, None),
                               height=dp(200),
                               auto_dismiss=False)

        self.dialog.add_action_button("Dismiss",
                                      action=lambda *x: self.dialog.dismiss())
        self.dialog.open()
github AndreMiras / KivyMD / kivymd / date_picker.py View on Github external
if do_again:
            Clock.schedule_once(lambda x: self.move_resize(do_again=False), 0.01)


class DayButton(ThemableBehavior, CircularRippleBehavior, ButtonBehavior,
                AnchorLayout):
    text = StringProperty()
    owner = ObjectProperty()
    is_today = BooleanProperty(False)
    is_selected = BooleanProperty(False)

    def on_release(self):
        self.owner.set_selected_widget(self)


class WeekdayLabel(MDLabel):
    pass


class MDDatePicker(FloatLayout, ThemableBehavior, RectangularElevationBehavior,
                   SpecificBackgroundColorBehavior, ModalView):
    _sel_day_widget = ObjectProperty()
    cal_list = None
    cal_layout = ObjectProperty()
    sel_year = NumericProperty()
    sel_month = NumericProperty()
    sel_day = NumericProperty()
    day = NumericProperty()
    month = NumericProperty()
    year = NumericProperty()
    today = date.today()
    callback = ObjectProperty()
github gitcd-io / gitcd / gitcd / interface / kivy / upgrade.py View on Github external
def loadVersions(self):
        localVersion = self.helper.getLocalVersion()

        try:
            pypiVersion = self.helper.getPypiVersion()
        except GitcdPyPiApiException as e:
            pypiVersion = 'error could not fetch the api'

        versionText = 'Local Version: %s' % localVersion
        versionText += '\nPyPI Version: %s' % pypiVersion

        label = MDLabel(
            text = versionText,
            theme_text_color = 'Primary',
            size_hint = [None, None],
            size = [264, 40],
            pos_hint = {'center_x': 0.3, 'center_y': 0.65}
        )

        self.remove_widget(self.ids.spinner)
        self.add_widget(label)

        if self.helper.isUpgradable():
            self.ids.buttonUpgrade.disabled = False
github AndreMiras / KivyMD / kivymd / search.py View on Github external
def __init__(self, **kwargs):
        self._hint_lbl = MDLabel(font_style='Subhead',
                                 halign='left',
                                 valign='middle')
        super(SearchTextInput, self).__init__(**kwargs)
github AndreMiras / KivyMD / kivymd / textfields.py View on Github external
disabled_color: self.theme_cls.disabled_hint_text_color
    text_size: (self.width, None)
''')


class FixedHintTextInput(TextInput):
    hint_text = StringProperty('')

    def on__hint_text(self, instance, value):
        pass

    def _refresh_hint_text(self):
        pass


class TextfieldLabel(MDLabel):
    def on_theme_text_color(self, instance, value):
        t = self.theme_cls
        op = self.opposite_colors
        setter = self.setter('color')
        t.unbind(**self._currently_bound_property)
        c = {}
        if value == 'Primary':
            c = {'text_color' if not op else 'opposite_text_color': setter}
            t.bind(**c)
            self.color = t.text_color if not op else t.opposite_text_color
        elif value == 'Secondary':
            c = {'secondary_text_color' if not op else
                 'opposite_secondary_text_color': setter}
            t.bind(**c)
            self.color = t.secondary_text_color if not op else \
                t.opposite_secondary_text_color
github AndreMiras / KivyMD / demos / kitchen_sink / main.py View on Github external
def show_example_dialog(self):
        content = MDLabel(font_style='Body1',
                          theme_text_color='Secondary',
                          text="This is a dialog with a title and some text. "
                               "That's pretty awesome right!",
                          size_hint_y=None,
                          valign='top')
        content.bind(texture_size=content.setter('size'))
        self.dialog = MDDialog(title="This is a test dialog",
                               content=content,
                               size_hint=(.8, None),
                               height=dp(200),
                               auto_dismiss=False)

        self.dialog.add_action_button("Dismiss",
                                      action=lambda *x: self.dialog.dismiss())
        self.dialog.open()
github AndreMiras / KivyMD / kivymd / settings / formats.py View on Github external
# 2 buttons are created for accept or cancel the current value
        btnlayout = BoxLayout(size_hint_y=None, height='50dp', spacing='5dp')
        btn = Button(text='Ok')
        btn.bind(on_release=self._validate)
        btnlayout.add_widget(btn)
        btn = Button(text='Cancel')
        btn.bind(on_release=self._dismiss)
        btnlayout.add_widget(btn)
        content.add_widget(btnlayout)

        # all done, open the popup !
        popup.open()


class KivyMDSettingTitle(MDLabel):
    title = Label.text
    theme_text_color = 'Primary'
    panel = ObjectProperty(None)

class KivyMDSettingTime(KivyMDSettingString):
    def on_release(self):
        time_picker = MDTimePicker()
        time_picker.set_time(datetime.datetime.strptime(self.value, '%H:%M'))
        time_picker.bind(time=self._set_value)
        time_picker.open()

    def _set_value(self, instance, value):
        self.value = value.strftime('%H:%M')


class KivyMDSettingDate(KivyMDSettingString):