1
當我嘗試將一個id分配給畫布時,出現錯誤Invalid data after declaration
,但是我看不到任何其他方式(例如e1)引用了下面的id。我如何在Python代碼中引用e1?我如何在Kivy的畫布中引用孩子的ID?
<MyClockWidget>:
face: face
ticks: ticks
el1: el1
FloatLayout:
id: face
size_hint: None, None
pos_hint: {"center_x":0.5, "center_y":0.5}
size: 0.9*min(root.size), 0.9*min(root.size)
canvas:
id: cand
Color:
rgb: 0.5, 0.5, 0.5
Ellipse:
size: self.size
pos: self.pos
canvas:
Color:
rgb: 0.1, 0.1, 0.1
Ellipse:
id: el1
size: self.size
pos: self.pos
angle_start: 0
angle_end: 90
Ellipse:
id: el2
size: self.size
pos: self.pos
angle_start: 110
angle_end: 130
看一看[這個問題](http://stackoverflow.com/questions/23625507/how-can-i-remove -specific-instructions-from-kivy-widget-canvas),它解釋瞭如何訪問(和刪除)特定的指令。如果要更改指令的屬性,請將它們綁定到根節點的屬性(如'<...>:e1_start:0' ...'Ellipse:angle_start:root.e1_start')。 – zeeMonkeez
@zeeMonkeez你幫了我很大的忙,我昨晚在午夜過夜時把我的頭撞在了牆上。如果您將此作爲答案提交,我會很樂意接受,謝謝! – howMuchCheeseIsTooMuchCheese