其他分享
首页 > 其他分享> > kivy 选择框

kivy 选择框

作者:互联网

from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.lang import builder

# 注册全文使用字体
from kivy.core.text import LabelBase
LabelBase.register(name='Font_Hanzi',fn_regular='./font/simsun.ttc')


builder.Builder.load_string("""
<SpinnerBox>:
    Spinner:
        size_hint:None,None
        size:100,44
        pos_hint:{'center':(.5,.5)}
        text:'Home'
        font_name:'Font_Hanzi'
        # 下拉显示的值
        values:'1','2','3','4'
        # 点击触发
        on_text:print('>>>>>>>',self.text)
""")


class SpinnerBox(BoxLayout):
    def __init__(self,**kwargs):
        super().__init__(**kwargs)


class MyApp(App):
    def build(self):
        return SpinnerBox()


if __name__ == '__main__':
    MyApp().run()

 

标签:__,name,text,self,选择,kivy,import
来源: https://www.cnblogs.com/vip136510786/p/15099738.html