Kivy Spinner - 值大小 [英] Kivy Spinner - Values Size

查看:15
本文介绍了Kivy Spinner - 值大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法从 Spinner 中的 values 参数更改文本大小?我发现我可以更改下拉框的高度和宽度,并更改标签"的大小.(层).但是有没有办法改变 headsall 的文本大小?

Is there a way to change the text size from the values argument within Spinner? I've found that I can change the height and width of the dropdown boxes and change the size of the "label" (Layer). But is there a way to change the text size of both heads and all?

Spinner:
    id: spinner_lry
    text: 'Layer'
    values:['heads', 'all']
    size_hint_y: None
    height: 50
    font_size: 20

推荐答案

是的,Spinner 中的选项是使用 SpinnerOption 类显示的(只是一个 按钮)默认.您可以使用 option_cls 属性设置不同的类来显示选项,并为该类指定 font_size,就像在 kv 中这样:

Yes, the options in a Spinner are displayed using the SpinnerOption class (just a Button) by default. You can set a different class to display the options using option_cls atribute, and specify the font_size for that class, like this in your kv:

<MyOption@SpinnerOption>:
    font_size: 50

Spinner:
    id: spinner_lry
    text: 'Layer'
    option_cls: "MyOption"
    values:['heads', 'all']
    size_hint_y: None
    height: 50
    font_size: 20

这篇关于Kivy Spinner - 值大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆