本文整理匯總了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)
示例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
示例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()
示例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()
示例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)
示例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()
示例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'))
示例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
示例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()
示例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')
示例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))
示例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
示例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