2
我创建一个自定义按钮,如下更改自定义按钮属性
#: import icon kivy.garden.iconfonts.icon
<[email protected]>:
background_normal: 'icons/backg.png'
RelativeLayout:
size: self.parent.width, self.parent.height
top: self.parent.top
right: self.parent.right
Label:
canvas.before:
Color:
rgba: 1,1,1,1
Rectangle:
pos: self.pos
size: self.size
source: 'icons/restaurant.png'
color: 0,0,0,1
id: icon_name
markup: True
font_size: '20dp'
text: '{}'.format(icon('ion-settings', 38))
pos_hint: {'center_y': .5, 'right': .25}
size_hint: .18, .9
Label:
text:'Change Settings'
id: label
color: 0,0,0,1
text_size: self.size
halign: 'left'
valign: 'middle'
font_size: '20dp'
pos_hint: {'center_y': .5, 'right': 1}
size_hint: .7, .9
我希望能够通过这个(Custom_Button)作为一个孩子不同的布局,和一些属性更改为我想要什么。这就是我的意思。 例如,
GridLayout:
custom_Button
custom_Button
custom_Button
但是我想能够明确地更改标签的图标在custom_Button第一个标签,也是在第二个标签的文本,因此,对于cutom_Button一个的三个实例会显示不同的图标和文字。我真的不知道如何实现这一点。所以请我需要一些帮助。 示例代码将非常有帮助。在此先感谢...
正是我需要的。非常感谢 –