I have a floatlayout with some widgets inside:
fl = FloatLayout(size=(600,600),
pos_hint=({'center_x': .5, 'center_y': .5}))
pos1 = ImgButton(source='zulgrey.png',
size_hint=(0.2,0.2),
pos_hint=({'center_x': 0, 'center_y': .43}))
pos2 = ImgButton(source='zulgrey.png',
size_hint=(0.2,0.2),
pos_hint=({'center_x': 0.5, 'center_y': 0.93}))
pos3 = ImgButton(source='zulgrey.png',
size_hint=(0.2,0.2),
pos_hint=({'center_x': 1, 'center_y': .43}))
pos4 = ImgButton(source='zulgrey.png',
size_hint=(0.2,0.2),
pos_hint=({'center_x': 0.5, 'center_y': .43}))
fl.add_widget(cove)
fl.add_widget(pos1)
fl.add_widget(pos2)
fl.add_widget(pos3)
fl.add_widget(pos4)
However when I resize the window the positions of the widgets move from where I intended them to be. Is there a way I can force the floatlayout to have a fixed aspect ratio on resize?
Solved it like this:
FloatLayout:
size_hint: 1, None
size: self.width, self.width
size_hint: 1 doesn't have to be one, I just wanted my square to fill the size of the FloatLayout.
Alternatively:
FloatLayout:
size_hint: None, 1
size: self.height, self.height