當前位置: 首頁>>代碼示例>>Python>>正文


Python metrics.sp方法代碼示例

本文整理匯總了Python中kivy.metrics.sp方法的典型用法代碼示例。如果您正苦於以下問題:Python metrics.sp方法的具體用法?Python metrics.sp怎麽用?Python metrics.sp使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在kivy.metrics的用法示例。


在下文中一共展示了metrics.sp方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: on_touch_move

# 需要導入模塊: from kivy import metrics [as 別名]
# 或者: from kivy.metrics import sp [as 別名]
def on_touch_move(self, touch):
        if self._get_uid('svavoid') in touch.ud or\
                self._drag_touch is not touch:
            return super(DragBehavior, self).on_touch_move(touch) or\
                self._get_uid() in touch.ud
        if touch.grab_current is not self:
            return True

        uid = self._get_uid()
        ud = touch.ud[uid]
        mode = ud['mode']
        if mode == 'unknown':
            ud['dx'] += abs(touch.dx)
            ud['dy'] += abs(touch.dy)
            if ud['dx'] > sp(self.drag_distance):
                mode = 'drag'
            if ud['dy'] > sp(self.drag_distance):
                mode = 'drag'
            ud['mode'] = mode
        if mode == 'drag':
            self.x += touch.dx
            self.y += touch.dy
        return True 
開發者ID:BillBillBillBill,項目名稱:Tickeys-linux,代碼行數:25,代碼來源:behaviors.py

示例2: _toggle_dropdown

# 需要導入模塊: from kivy import metrics [as 別名]
# 或者: from kivy.metrics import sp [as 別名]
def _toggle_dropdown(self, *largs):
        self.is_open = not self.is_open
        ddn = self._dropdown
        ddn.size_hint_x = None
        if not ddn.container:
            return
        children = ddn.container.children

        if children:
            ddn.width = max([self.width, children[0].minimum_width])
        else:
            ddn.width = self.width

        for item in children:
            item.size_hint_y = None
            item.height = max([self.height, sp(48)]) 
開發者ID:BillBillBillBill,項目名稱:Tickeys-linux,代碼行數:18,代碼來源:actionbar.py

示例3: generate_new_data

# 需要導入模塊: from kivy import metrics [as 別名]
# 或者: from kivy.metrics import sp [as 別名]
def generate_new_data(self):
        # Create a data set
        contacts = []
        names = ["Robert", "George", "Joseph", "Donald", "Mark", "Anthony", "Gary"]
        medias = [
            "http://www.geglobalresearch.com/media/Alhart-Todd-45x45.jpg",
            "http://www.geglobalresearch.com/media/Alhart-Todd-45x45.jpg",
        ]
        for x in range(1000):
            if x % 100 == 0:
                contacts.append({
                    "viewclass": "ContactSeparator",
                    "height": sp(20)
                })
            contacts.append({
                "index": x,
                "viewclass": "ContactItem",
                "contact_media": random.choice(medias),
                "contact_name": "{} {}".format(
                    random.choice(names),
                    random.choice(names)
                )
            })

        self.root.ids.rv.data = contacts 
開發者ID:kivy-garden,項目名稱:garden.recycleview,代碼行數:27,代碼來源:main.py

示例4: editor_popup

# 需要導入模塊: from kivy import metrics [as 別名]
# 或者: from kivy.metrics import sp [as 別名]
def editor_popup(title, content, answerCallback, size_hint=(None, None), size=(dp(500), dp(220)), hide_ok=False, auto_dismiss_time=None):

    def auto_dismiss(*args):
        popup.dismiss()

    def on_title(instance, title):
        popup.title = title

    content.bind(on_title=on_title)
    content = EditorPopup(content=content, hide_ok=hide_ok)
    content.bind(on_answer=answerCallback)
    popup = Popup(title=title,
                    content=content,
                    size=size, size_hint=size_hint,
                    auto_dismiss=True,
                  title_size=sp(18))
    popup.open()

    if auto_dismiss_time:
        Clock.create_trigger(auto_dismiss, auto_dismiss_time)()

    return popup 
開發者ID:autosportlabs,項目名稱:RaceCapture_App,代碼行數:24,代碼來源:alertview.py

示例5: __init__

# 需要導入模塊: from kivy import metrics [as 別名]
# 或者: from kivy.metrics import sp [as 別名]
def __init__(self, **kwargs):
		super(MDCheckbox, self).__init__(**kwargs)
		self.register_event_type('on_active')
		self.check_anim_out = Animation(font_size=0, duration=.1, t='out_quad')
		self.check_anim_in = Animation(font_size=sp(24), duration=.1,
		                               t='out_quad')
		self.check_anim_out.bind(
			on_complete=lambda *x: self.check_anim_in.start(self)) 
開發者ID:kivymd,項目名稱:KivyMD,代碼行數:10,代碼來源:selectioncontrols.py

示例6: on_font_style

# 需要導入模塊: from kivy import metrics [as 別名]
# 或者: from kivy.metrics import sp [as 別名]
def on_font_style(self, instance, style):
		info = self._font_styles[style]
		self.font_name = info[0]
		self.bold = info[1]
		if DEVICE_TYPE == 'desktop' and info[3] is not None:
			self.font_size = sp(info[3])
		else:
			self.font_size = sp(info[2]) 
開發者ID:kivymd,項目名稱:KivyMD,代碼行數:10,代碼來源:label.py

示例7: on_pos

# 需要導入模塊: from kivy import metrics [as 別名]
# 或者: from kivy.metrics import sp [as 別名]
def on_pos(self, *args):
		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:kivymd,項目名稱:KivyMD,代碼行數:10,代碼來源:textfields.py

示例8: apply_distance

# 需要導入模塊: from kivy import metrics [as 別名]
# 或者: from kivy.metrics import sp [as 別名]
def apply_distance(self, distance):
        os = abs(self.overscroll)
        if os:
            distance /= 1. + os / sp(200.)
        super(DampedScrollEffect, self).apply_distance(distance) 
開發者ID:BillBillBillBill,項目名稱:Tickeys-linux,代碼行數:7,代碼來源:dampedscroll.py

示例9: __init__

# 需要導入模塊: from kivy import metrics [as 別名]
# 或者: from kivy.metrics import sp [as 別名]
def __init__(self, **kwargs):
        super(FieldLabel, self).__init__(**kwargs)
        self.bind(width=self.width_changed)
        self.spacing = (20, 3)
        self.font_name = "resource/fonts/ASL_regular.ttf"
        self.font_size = sp(20)
        self.shorten = True
        self.shorten_from = 'right' 
開發者ID:autosportlabs,項目名稱:RaceCapture_App,代碼行數:10,代碼來源:fieldlabel.py

示例10: spct

# 需要導入模塊: from kivy import metrics [as 別名]
# 或者: from kivy.metrics import sp [as 別名]
def spct(pct):
    scale = sp(1)
    scale = scale * 0.9 if scale > 1 else scale
    return (pct * scale) 
開發者ID:autosportlabs,項目名稱:RaceCapture_App,代碼行數:6,代碼來源:utils.py

示例11: __init__

# 需要導入模塊: from kivy import metrics [as 別名]
# 或者: from kivy.metrics import sp [as 別名]
def __init__(self, **kwargs):
        super(TextWidget, self).__init__(**kwargs)
        self.bind(width=self.width_changed)
        self.spacing = (20,3)
        self.font_name = "resource/fonts/ASL_light.ttf"
        self.font_size = sp(20) 
開發者ID:autosportlabs,項目名稱:RaceCapture_App,代碼行數:8,代碼來源:textwidget.py

示例12: __init__

# 需要導入模塊: from kivy import metrics [as 別名]
# 或者: from kivy.metrics import sp [as 別名]
def __init__(self, **kwargs):
        super(PulseChannelsView, self).__init__(**kwargs)
        self.channel_title = 'Timer '
        self.accordion_item_height = sp(150) 
開發者ID:autosportlabs,項目名稱:RaceCapture_App,代碼行數:6,代碼來源:timerchannelsview.py

示例13: __init__

# 需要導入模塊: from kivy import metrics [as 別名]
# 或者: from kivy.metrics import sp [as 別名]
def __init__(self, **kwargs):
        super(GPIOChannelsView, self).__init__(**kwargs)
        self.channel_title = 'Digital Input/Output '
        self.accordion_item_height = sp(120) 
開發者ID:autosportlabs,項目名稱:RaceCapture_App,代碼行數:6,代碼來源:gpiochannelsview.py

示例14: set_error

# 需要導入模塊: from kivy import metrics [as 別名]
# 或者: from kivy.metrics import sp [as 別名]
def set_error(self, error):
        if self.warn_bubble is None:
            warn = CenteredBubble()
            warn.add_widget(WarnLabel(text=str(error), font_size=sp(12)))
            warn.background_color = (1, 0, 0, 1.0)
            warn.auto_dismiss_timeout(self.WARN_LONG_TIMEOUT)
            control = kvFind(self, 'rcid', 'control')
            warn.size = (control.width, dp(50))
            warn.size_hint = (None, None)
            self.add_widget(warn)
            warn.center_below(control)
            self.warn_bubble = warn
            Clock.schedule_once(lambda dt: self.clear_error(), self.WARN_LONG_TIMEOUT) 
開發者ID:autosportlabs,項目名稱:RaceCapture_App,代碼行數:15,代碼來源:settingsview.py

示例15: __init__

# 需要導入模塊: from kivy import metrics [as 別名]
# 或者: from kivy.metrics import sp [as 別名]
def __init__(self, **kwargs):
        super(MDCheckbox, self).__init__(**kwargs)
        self.register_event_type('on_active')
        self.check_anim_out = Animation(font_size=0, duration=.1, t='out_quad')
        self.check_anim_in = Animation(font_size=sp(24), duration=.1,
                                       t='out_quad')
        self.check_anim_out.bind(
            on_complete=lambda *x: self.check_anim_in.start(self)) 
開發者ID:kiok46,項目名稱:Blogs-Posts-Tutorials,代碼行數:10,代碼來源:selectioncontrols.py


注:本文中的kivy.metrics.sp方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。