I have the following Kivy Option Popup
s ='''
<OptionPopup>:
id: optionPopup
size_hint : (None,None)
width : min(0.95 * self.window.width, dp(500))
title: "Option Title"
height: content.height
BoxLayout:
id: content
orientation: 'vertical'
spacing: '5dp'
height: contentButtons.height + cancelButton.height
BoxLayout:
id: contentButtons
orientation: 'vertical'
spacing: '0dp'
height : self.minimum_height
SettingSpacer:
Button:
id:cancelButton
size_hint_y : None
height: '50dp'
text: "Back"
on_release: optionPopup._dismiss()
'''
Builder.load_string(s)
This Popup exists only once in my application and I will dynamically add Buttons to the optionPopup.ids["contentButtons"]
. Meaning the contentButton
layout minimum_height
gets changed. How can I properly adjust the size of my parent Boxlayouts content
and the PopUp windows?
The above kv
options seem to do the right thing like binding optionPopup.height
to content.height
, but it does not work?
The correct kv settings are
You can test this code by adding it to your application: