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一個的三個實例會顯示不同的圖標和文字。我真的不知道如何實現這一點。所以請我需要一些幫助。 示例代碼將非常有幫助。在此先感謝...
正是我需要的。非常感謝 –