当前位置: 首页>>代码示例>>Python>>正文


Python label.MDLabel方法代码示例

本文整理汇总了Python中kivymd.label.MDLabel方法的典型用法代码示例。如果您正苦于以下问题:Python label.MDLabel方法的具体用法?Python label.MDLabel怎么用?Python label.MDLabel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kivymd.label的用法示例。


在下文中一共展示了label.MDLabel方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: on_touch_down

# 需要导入模块: from kivymd import label [as 别名]
# 或者: from kivymd.label import MDLabel [as 别名]
def on_touch_down(self, touch):
        if self.collide_point(*touch.pos):
            self.pressed = touch.pos
            print(str(self.text))
            content = MDLabel(font_style='Body1',
                          theme_text_color='Secondary',
                          text="{}".format(self.secondary_text),
                          size_hint_y=None,
                          valign='top')
            content.bind(texture_size=content.setter('size'))
            self.dialog = MDDialog(title="{}".format(self.text),
                                   content=content,
                                   size_hint=(.9, None),
                                   height=dp(300),
                                   auto_dismiss=False)

            self.dialog.add_action_button("Dismiss",
                                          action=lambda *x: self.dialog.dismiss())
            self.dialog.open()

        super(PopList, self).on_touch_down(touch) 
开发者ID:mcroni,项目名称:kivy_gosh,代码行数:23,代码来源:testimonies.py

示例2: create_dialog_helper

# 需要导入模块: from kivymd import label [as 别名]
# 或者: from kivymd.label import MDLabel [as 别名]
def create_dialog_helper(cls, title, body):
        """
        Creates a dialog from given title and body.
        Adds it to the dialogs track list.
        """
        content = MDLabel(
                    font_style='Body1',
                    theme_text_color='Secondary',
                    text=body,
                    size_hint_y=None,
                    valign='top')
        content.bind(texture_size=content.setter('size'))
        dialog = MDDialog(
                        title=title,
                        content=content,
                        size_hint=(.8, None),
                        height=dp(250),
                        auto_dismiss=False)
        dialog.bind(on_dismiss=cls.on_dialog_dismiss)
        with cls.__lock:
            cls.dialogs.append(dialog)
        return dialog 
开发者ID:AndreMiras,项目名称:PyWallet,代码行数:24,代码来源:main.py

示例3: show_example_dialog

# 需要导入模块: from kivymd import label [as 别名]
# 或者: from kivymd.label import MDLabel [as 别名]
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() 
开发者ID:gamblecd,项目名称:pi-photo-booth,代码行数:19,代码来源:kivyMDDemo.py

示例4: show_example_dialog

# 需要导入模块: from kivymd import label [as 别名]
# 或者: from kivymd.label import MDLabel [as 别名]
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!",
                          valign='top')

        content.bind(size=content.setter('text_size'))
        self.dialog = MDDialog(title="This is a pretty 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() 
开发者ID:captainbupt,项目名称:KivyMdDemo,代码行数:20,代码来源:main.py

示例5: on_touch_down

# 需要导入模块: from kivymd import label [as 别名]
# 或者: from kivymd.label import MDLabel [as 别名]
def on_touch_down(self, touch):
        if self.collide_point(*touch.pos):
            self.pressed = touch.pos
            if touch.is_double_tap:
                print('doouble')
            else:
                content = MDLabel(font_style='Body1',
                                  theme_text_color='Secondary',
                                  text="{}".format(self.secondary_text),
                                  valign='top')

                content.bind(size=content.setter('text_size'))
                self.dialog = MDDialog(title="{}".format(self.text), content=content, size_hint=(.9, None),
                                       height=dp(200), auto_dismiss=False)

                self.dialog.add_action_button("Dismiss",
                                              action=lambda *x: self.dialog.dismiss())
                self.dialog.add_action_button("Share",
                                              action=lambda *x: self.share())
                self.dialog.open()
        super(QuoteButton, self).on_touch_down(touch) 
开发者ID:mcroni,项目名称:kivy_gosh,代码行数:23,代码来源:quotes.py

示例6: show_example_dialog

# 需要导入模块: from kivymd import label [as 别名]
# 或者: from kivymd.label import MDLabel [as 别名]
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!",
                          valign='top')

        content.bind(size=content.setter('text_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() 
开发者ID:cruor99,项目名称:KivyMD,代码行数:20,代码来源:kitchen_sink.py

示例7: __init__

# 需要导入模块: from kivymd import label [as 别名]
# 或者: from kivymd.label import MDLabel [as 别名]
def __init__(self, **kwargs):
        self._msg_label = MDLabel(font_style='Caption',
                                  theme_text_color='Error',
                                  halign='left',
                                  valign='middle')

        self._hint_lbl = MDLabel(font_style='Subhead',
                                 halign='left',
                                 valign='middle')
        super(SingleLineTextField, self).__init__(**kwargs)
        self.line_color_normal = self.theme_cls.divider_color
        self.line_color_focus = self.theme_cls.primary_color
        self.error_color = self.theme_cls.error_color
        self._hint_txt_color = self.theme_cls.disabled_hint_text_color
        self.hint_text_color = (1, 1, 1, 0)
        self.cursor_color = self.theme_cls.primary_color

        self.bind(error_message=self._set_msg,
                  hint_text=self._set_hint,
                  _hint_lbl_font_size=self._hint_lbl.setter('font_size')) 
开发者ID:cruor99,项目名称:KivyMD,代码行数:22,代码来源:textfields.py

示例8: dialog

# 需要导入模块: from kivymd import label [as 别名]
# 或者: from kivymd.label import MDLabel [as 别名]
def dialog(font_style='Body1', theme_text_color='Secondary', title='Title',
           text='Text', valign='top', dismiss=True, buttons=None,
           ref_callback=None):
    '''????? ?????????? ????.'''

    if buttons is None:
        buttons = []

    content = MDLabel(font_style=font_style, theme_text_color=theme_text_color,
                      text=text, valign=valign, markup=True)
    content.bind(size=content.setter('text_size'))
    if ref_callback:
        content.bind(on_ref_press=ref_callback)

    dialog = MDDialog(title=title, content=content, size_hint=(.8, None),
                      height=dp(200), auto_dismiss=dismiss)

    for list_button in buttons:
        text_button, action_button = list_button
        dialog.add_action_button(text_button, action=action_button)
    dialog.open()

    return dialog 
开发者ID:HeaTTheatR,项目名称:DemoKivyContacts,代码行数:25,代码来源:dialogs.py

示例9: show_example_long_dialog

# 需要导入模块: from kivymd import label [as 别名]
# 或者: from kivymd.label import MDLabel [as 别名]
def show_example_long_dialog(self):
        content = MDLabel(font_style='Body1',
                          theme_text_color='Secondary',
                          text="Lorem ipsum dolor sit amet, consectetur "
                               "adipiscing elit, sed do eiusmod tempor "
                               "incididunt ut labore et dolore magna aliqua. "
                               "Ut enim ad minim veniam, quis nostrud "
                               "exercitation ullamco laboris nisi ut aliquip "
                               "ex ea commodo consequat. Duis aute irure "
                               "dolor in reprehenderit in voluptate velit "
                               "esse cillum dolore eu fugiat nulla pariatur. "
                               "Excepteur sint occaecat cupidatat non "
                               "proident, sunt in culpa qui officia deserunt "
                               "mollit anim id est laborum.",
                          size_hint_y=None,
                          valign='top')
        content.bind(texture_size=content.setter('size'))
        self.dialog = MDDialog(title="This is a long 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() 
开发者ID:gamblecd,项目名称:pi-photo-booth,代码行数:28,代码来源:kivyMDDemo.py

示例10: __init__

# 需要导入模块: from kivymd import label [as 别名]
# 或者: from kivymd.label import MDLabel [as 别名]
def __init__(self, **kwargs):
        Clock.schedule_interval(self._update_color, 5)
        self._msg_lbl = MDLabel(font_style='Caption',
                                theme_text_color='Error',
                                halign='left',
                                valign='middle',
                                text=self.message)

        self._hint_lbl = MDLabel(font_style='Subhead',
                                 halign='left',
                                 valign='middle')
        super(SingleLineTextField, self).__init__(**kwargs)
        self.line_color_normal = self.theme_cls.divider_color
        self.line_color_focus = list(self.theme_cls.primary_color)
        self.base_line_color_focus = list(self.theme_cls.primary_color)
        self.error_color = self.theme_cls.error_color

        self._hint_txt_color = self.theme_cls.disabled_hint_text_color
        self.hint_text_color = (1, 1, 1, 0)
        self.cursor_color = self.theme_cls.primary_color
        self.bind(message=self._set_msg,
                  hint_text=self._set_hint,
                  _hint_lbl_font_size=self._hint_lbl.setter('font_size'),
                  message_mode=self._set_mode)
        self.hint_anim_in = Animation(_hint_y=dp(34),
                                      _hint_lbl_font_size=sp(12), duration=.2,
                                      t='out_quad')

        self.hint_anim_out = Animation(_hint_y=dp(10),
                                       _hint_lbl_font_size=sp(16), duration=.2,
                                       t='out_quad') 
开发者ID:kiok46,项目名称:Blogs-Posts-Tutorials,代码行数:33,代码来源:textfields.py

示例11: on_noticed

# 需要导入模块: from kivymd import label [as 别名]
# 或者: from kivymd.label import MDLabel [as 别名]
def on_noticed(self, user, channel, action):
        user = user.split('!')[0]
        if user == 'ChanServ':
            content = MDLabel(font_style='Body1',
                              theme_text_color='Secondary',
                              text=action,
                              size_hint_y=None,
                              valign='top')
            content.bind(texture_size=content.setter('size'))
            self.dialog = MDDialog(title="Notice: {}".format(user),
                                   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()
        else:
            self.msg_list.add_widget(
                MultiLineListItem(
                    text="[b][color=F44336]" + user + "[/color][/b] " + action,
                    font_style='Subhead',
                )
            )
            self.msg_list.parent.scroll_to(self.msg_list.children[0])
        Logger.info("IRC NOTICED: <%s> %s %s" % (user, channel, action)) 
开发者ID:manthansharma,项目名称:kivy-irc,代码行数:29,代码来源:status_tab.py

示例12: _get_contacts_group

# 需要导入模块: from kivymd import label [as 别名]
# 或者: from kivymd.label import MDLabel [as 别名]
def _get_contacts_group(self, contacts_group):
        '''?????????? ?????? MDLabel - "????????? ???",
        ???? ???????? ? ?????? ??????????? ??? ?????? ?? ???????
        ??????????? ? ?????? ?????????.'''

        if not contacts_group.__len__():
            return MDLabel(
                text=self.data.string_lang_not_contacts,
                font_style='Headline', halign='center',
                theme_text_color='Custom',
                text_color=self.data.text_color
            )
        else:
            for contact_name in contacts_group:
                info_contacts = {contact_name: self.info_contacts[contact_name]}
                if not self._contacts_list_in_group:
                    contacts_list = ContactsList()
                    self._contacts_list_in_group = Lists(
                        dict_items=info_contacts, flag='three_list_custom_icon',
                        right_icons=self.data.right_icons[:1],
                        events_callback=self._event_contact_item
                    )
                    contacts_list.add_widget(self._contacts_list_in_group)
                else:
                    self._contacts_list_in_group.three_list_custom_icon(
                        info_contacts
                    )
            self._contacts_list_in_group = None

            return contacts_list 
开发者ID:HeaTTheatR,项目名称:DemoKivyContacts,代码行数:32,代码来源:creategroup.py

示例13: card

# 需要导入模块: from kivymd import label [as 别名]
# 或者: from kivymd.label import MDLabel [as 别名]
def card(content, title=None, background_color=None, size=(.7, .5)):
    '''????? ?????????? ???? ? ????????? ?????????.'''

    if not background_color:
        background_color = [1.0, 1.0, 1.0, 1]

    card = MDCard(
        size_hint=(1, 1), padding=5, background_color=background_color
    )

    if title:
        box = BoxLayout(orientation='vertical', padding=dp(8))
        box.add_widget(
            MDLabel(
                text=title, theme_text_color='Secondary', font_style="Title",
                size_hint_y=None, height=dp(36)
            )
        )
        box.add_widget(MDSeparator(height=dp(1)))
        box.add_widget(content)
        card.add_widget(box)
    else:
        card.add_widget(content)

    dialog = ModalView(size_hint=size, background_color=[0, 0, 0, .2])
    dialog.add_widget(card)
    dialog.open()

    return dialog 
开发者ID:HeaTTheatR,项目名称:DemoKivyContacts,代码行数:31,代码来源:dialogs.py


注:本文中的kivymd.label.MDLabel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。