如何使用 kv 语言将 kivy 微调器按钮设置为自己的按钮 class?
How to set the kivy spinner buttons to an own button class by using the kv language?
我想在微调器中设置按钮 UI。下面是一些伪示例:
<TemplButton@Button>:
background_normal: 'gfx/button_bgr.png'
background_down: 'gfx/button_act.png'
<TemplSpinner@Spinner>:
background_normal: 'gfx/button_bgr.png'
background_down: 'gfx/button_act.png'
dropdown_cls: TemplButton
option_cls: TemplButton
欢迎任何帮助!
尝试使用 Factory
访问动态 class + 创建 SpinnerOption(Button) 的子class class
#:import Factory kivy.factory.Factory
<TemplButton@Button>:
background_normal: 'gfx/button_bgr.png'
background_down: 'gfx/button_act.png'
<TemplSpinnerOption@SpinnerOption>
background_normal: 'gfx/button_bgr.png'
background_down: 'gfx/button_act.png'
<TemplSpinner@Spinner>:
background_normal: 'gfx/button_bgr.png'
background_down: 'gfx/button_act.png'
option_cls: Factory.TemplSpinnerOption
我想在微调器中设置按钮 UI。下面是一些伪示例:
<TemplButton@Button>:
background_normal: 'gfx/button_bgr.png'
background_down: 'gfx/button_act.png'
<TemplSpinner@Spinner>:
background_normal: 'gfx/button_bgr.png'
background_down: 'gfx/button_act.png'
dropdown_cls: TemplButton
option_cls: TemplButton
欢迎任何帮助!
尝试使用 Factory
访问动态 class + 创建 SpinnerOption(Button) 的子class class
#:import Factory kivy.factory.Factory
<TemplButton@Button>:
background_normal: 'gfx/button_bgr.png'
background_down: 'gfx/button_act.png'
<TemplSpinnerOption@SpinnerOption>
background_normal: 'gfx/button_bgr.png'
background_down: 'gfx/button_act.png'
<TemplSpinner@Spinner>:
background_normal: 'gfx/button_bgr.png'
background_down: 'gfx/button_act.png'
option_cls: Factory.TemplSpinnerOption