Skip to content Skip to sidebar Skip to footer

How Can I Define Kivy Dropodown List Max Height According To The Screen Height?

I've created a DropDown list and dont want it to go all over the screen. So I tried to set the max_height value but i can only put absolute values. Instead, I want it to resize wit

Solution 1:

In your MainWindow class __init__(), you can replace

self.min_down.max_height = 100

with

self.bind(size=self.resizing)

And add a resizing() method to that class:

defresizing(self, screen, new_size):
    self.min_down.max_height = new_size[1] * 0.5self.min_down.width = new_size[0] / 10# the child of the DropDownList is a GridLayout that contains the buttonsfor btn inself.min_down.children[0].children:
        btn.width = self.min_down.width

This will adjust the max_height property whenever the MainWindow change its size.

Post a Comment for "How Can I Define Kivy Dropodown List Max Height According To The Screen Height?"