I am trying to get the Label called "number" to show up directly over the center of the Ellipse. I have tried putting both in the same layout, in different layouts, in AnchorLayouts and RelativeLayouts, and I haven't been able to figure out how to to this.
Here's a test version of my python showing the same issue:
for i in range(1,6):
temp = GamePiece(5, "Red")
temp.pos = (i*100,i*200)
def __init__(self, number, color, **kwargs):
self.number = number
self.player_color = color
self.background_normal = "5.png"
if __name__ == '__main__':
And my kivy:
on_size: self.size = root.size
#this is the ellipse in question
size: (root.width/2.5, root.height/3)
#pos: -15, -20
#this is the label I want centered over the ellipse
Here's what it currently looks like: (one of the togglebuttons is pressed for illustration purposes)
In your example, labels are as big as the anchor layouts they belong to, so you can't move them.
If you want them to have some other size, then disable
size_hint, and use a fixed
size (for instance, as big as the ellipses):
Label: #this is the label I want centered over the ellipse size_hint: None, None size: (root.width/2.5, root.height/3) id: number text: str(root.number) color: (1,1,1,1) font_size: root.height/4 bold: True #pos: root.pos