Created
April 11, 2016 20:16
-
-
Save kived/8bd465544f6c7f554842b3e8f1e30be2 to your computer and use it in GitHub Desktop.
Kivy: auto-sized dialog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<AppDialog>: | |
size_hint: 1, None | |
height: grid.minimum_height | |
GridLayout: | |
id: grid | |
size_hint_x: 0.8 | |
size_hint_y: None | |
height: self.minimum_height | |
on_height: root._align_center() | |
cols: 1 | |
padding: 0, dp(24) | |
spacing: dp(16) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AppDialog(ModalView): | |
def add_widget(self, *args, **kwargs): | |
if self.children: | |
return self.children[0].add_widget(*args, **kwargs) | |
return super(AppDialog, self).add_widget(*args, **kwargs) | |
def remove_widget(self, *args, **kwargs): | |
if self.children: | |
return self.children[0].remove_widget(*args, **kwargs) | |
return super(AppDialog, self).remove_widget(*args, **kwargs) | |
def clear_widgets(self, *args, **kwargs): | |
if self.children: | |
return self.children[0].clear_widgets(*args, **kwargs) | |
return super(AppDialog, self).clear_widgets(*args, **kwargs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment