Kivy Spinner - 值大小 [英] Kivy Spinner - Values Size
问题描述
有没有办法从 Spinner
中的 values
参数更改文本大小?我发现我可以更改下拉框的高度和宽度,并更改标签"的大小.(层).但是有没有办法改变 heads
和 all
的文本大小?
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屋!