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()