Overlapping content in popups in kivy

Viewed 195

I followed the documentation for using FileChoose on the kivy website (https://kivy.org/doc/stable/api-kivy.uix.filechooser.html). However, when I open the popup for LoadDialog() and click on one of the icons, there's a lot of overlap for the folder's content.

main.py

class Root(Screen):
    loadfile = ObjectProperty(None)
    savefile = ObjectProperty(None)
    text_input = ObjectProperty(None)

    def dismiss_popup(self):
        self._popup.dismiss()

    def show_load(self):
        content = LoadDialog(load=self.load, cancel=self.dismiss_popup)
        self._popup = Popup(title="Load file", content=content,
                            size_hint=(0.9, 0.9))
        self._popup.open()

class LoadDialog(FloatLayout):
    load = ObjectProperty(None)
    cancel = ObjectProperty(None)

main.kv

<LoadDialog>:
    BoxLayout:
        size: root.size
        pos: root.pos
        orientation: "vertical"
        FileChooserIconView:
            id: filechooser

            GridLayout:
                cols:2
                size_hint_y: None
                height: 30
                Button:
                    text: "Cancel"
                    on_release: root.cancel()

                Button:
                    text: "Load"
                    on_release: root.load(filechooser.path, filechooser.selection)

If I use BoxLayout instead of FloatLayout in the LoadDialog() class, the overlapping issue is solved, however, the popup is divided in half with two columns.

main.py

class LoadDialog(BoxLayout):
    load = ObjectProperty(None)
    cancel = ObjectProperty(None)

I've also tried using GridLayout, but that has the same overlapping issue as with FloatLayout.

0 Answers
Related