python类load_string()的实例源码

slider.py 文件源码 项目:Blogs-Posts-Tutorials 作者: kiok46 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def build(self):
            return Builder.load_string("""
BoxLayout:
    orientation:'vertical'
    BoxLayout:
        size_hint_y:None
        height: '48dp'
        Label:
            text:"Toggle disabled"
            color: [0,0,0,1]
        CheckBox:
            on_press: slider.disabled = not slider.disabled
    BoxLayout:
        size_hint_y:None
        height: '48dp'
        Label:
            text:"Toggle active"
            color: [0,0,0,1]
        CheckBox:
            on_press: slider.active = not slider.active
    BoxLayout:
        size_hint_y:None
        height: '48dp'
        Label:
            text:"Toggle show off"
            color: [0,0,0,1]
        CheckBox:
            on_press: slider.show_off = not slider.show_off

    MDSlider:
        id:slider
        min:0
        max:100
        value: 40

    MDSlider:
        id:slider2
        orientation:"vertical"
        min:0
        max:100
        value: 40

""")
progressbar.py 文件源码 项目:mobileinsight-mobile 作者: mobile-insight 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def build(self):
            Clock.schedule_interval(self.callback, 1)
            return Builder.load_string("""#:import MDSlider kivymd.slider.MDSlider
        #:import MDLabel kivymd.label.MDLabel
BoxLayout:
    orientation:'vertical'
    padding: '8dp'
    MDSlider:
        id:slider
        min:0
        max:100
        value: 10

    MDProgressBar:
        value: app.rvalue
        rgbr:"00FF00"
    MDProgressBar:
        reversed: True
        value: app.rvalue
        rgbr:"00FFFF"
    BoxLayout:
        MDProgressBar:
            orientation:"vertical"
            reversed: False
            value: slider.value
            rgbr:"FFFF00"
            test: True
            alpha:.7

        MDProgressBar:
            orientation:"vertical"
            value: slider.value
            reversed:True
            rgbr:"00ff77"

        MDLabel:
            text: str(app.rvalue)
            theme_text_color: 'Primary'
            font_style:"Caption"
            size_hint_y: None
            halign: 'center'
            height: self.texture_size[1] + dp(64)



""")
slider.py 文件源码 项目:mobileinsight-mobile 作者: mobile-insight 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def build(self):
            return Builder.load_string("""
BoxLayout:
    orientation:'vertical'
    BoxLayout:
        size_hint_y:None
        height: '48dp'
        Label:
            text:"Toggle disabled"
            color: [0,0,0,1]
        CheckBox:
            on_press: slider.disabled = not slider.disabled
    BoxLayout:
        size_hint_y:None
        height: '48dp'
        Label:
            text:"Toggle active"
            color: [0,0,0,1]
        CheckBox:
            on_press: slider.active = not slider.active
    BoxLayout:
        size_hint_y:None
        height: '48dp'
        Label:
            text:"Toggle show off"
            color: [0,0,0,1]
        CheckBox:
            on_press: slider.show_off = not slider.show_off

    MDSlider:
        id:slider
        min:0
        max:100
        value: 40

    MDSlider:
        id:slider2
        orientation:"vertical"
        min:0
        max:100
        value: 40

""")
accordion.py 文件源码 项目:kivy_gosh 作者: mcroni 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def build(self):
            # self.theme_cls.primary_palette = 'Indigo'
            return Builder.load_string("""
#:import MDLabel kivymd.label.MDLabel
BoxLayout:
    spacing: '64dp'
    MDAccordion:
        orientation: 'vertical'
        MDAccordionItem:
            title: 'Item 1'
            icon: 'home'
            MDAccordionSubItem:
                text: "Subitem 1"
            MDAccordionSubItem:
                text: "Subitem 2"
            MDAccordionSubItem:
                text: "Subitem 3"
        MDAccordionItem:
            title: 'Item 2'
            icon: 'earth'
            MDAccordionSubItem:
                text: "Subitem 4"
            MDAccordionSubItem:
                text: "Subitem 5"
            MDAccordionSubItem:
                text: "Subitem 6"
        MDAccordionItem:
            title: 'Item 3'
            MDAccordionSubItem:
                text: "Subitem 7"
            MDAccordionSubItem:
                text: "Subitem 8"
            MDAccordionSubItem:
                text: "Subitem 9"
    MDAccordion:
        orientation: 'horizontal'
        MDAccordionItem:
            title:'Item 1'
            icon: 'home'
            MDLabel:
                text:'Content 1'
                theme_text_color:'Primary'
        MDAccordionItem:
            title:'Item 2'
            MDLabel:
                text:'Content 2'
                theme_text_color:'Primary'
        MDAccordionItem:
            title:'Item 3'
            MDLabel:
                text:'Content 3'
                theme_text_color:'Primary'
""")
slider.py 文件源码 项目:kivy_gosh 作者: mcroni 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def build(self):
            return Builder.load_string("""
BoxLayout:
    orientation:'vertical'
    BoxLayout:
        size_hint_y:None
        height: '48dp'
        Label:
            text:"Toggle disabled"
            color: [0,0,0,1]
        CheckBox:
            on_press: slider.disabled = not slider.disabled
    BoxLayout:
        size_hint_y:None
        height: '48dp'
        Label:
            text:"Toggle active"
            color: [0,0,0,1]
        CheckBox:
            on_press: slider.active = not slider.active
    BoxLayout:
        size_hint_y:None
        height: '48dp'
        Label:
            text:"Toggle show off"
            color: [0,0,0,1]
        CheckBox:
            on_press: slider.show_off = not slider.show_off

    MDSlider:
        id:slider
        min:0
        max:100
        value: 40

    MDSlider:
        id:slider2
        orientation:"vertical"
        min:0
        max:100
        value: 40

""")


问题


面经


文章

微信
公众号

扫码关注公众号