Python 2.7 GridLayout Python Kivy元素中的空间

Python 2.7 GridLayout Python Kivy元素中的空间,python-2.7,kivy,kivy-language,Python 2.7,Kivy,Kivy Language,我正在编写一个简单的python Kivy GUI,用于读取用户选择的文件的内容。我遇到的问题是,在Gui屏幕之后,内部GridLayout的元素中不需要一个空间 代码输出 如您所见,有两个矩形空间我没有声明,在.kv文件中编写的相关代码是: GridLayout: id: grid_1_level_one cols: 1 rows: 3 GridLayout: id: grid_1_level_two

我正在编写一个简单的python Kivy GUI,用于读取用户选择的文件的内容。我遇到的问题是,在Gui屏幕之后,内部GridLayout的元素中不需要一个空间

代码输出

如您所见,有两个矩形空间我没有声明,在.kv文件中编写的相关代码是:

GridLayout:
        id: grid_1_level_one
        cols: 1
        rows: 3
        GridLayout:
            id: grid_1_level_two
            cols: 1
            rows: 1
            height: 100
            size_hint_y: None
            Label:
                id: title_parameters_view
                valign: 'middle'
                halign: 'center'
                text: "Parameters"
                size: self.texture_size
        GridLayout:
            id: grid_2_level_two
            cols: 2
            rows: 1
            #size_hint_y: None
            height: self.minimum_height
            FileChooserListView:
                id: visualize_file_chooser_variables
                canvas.before:
                    Color:
                        rgba: hex('#413FBF')
                    Rectangle:
                        pos: self.pos
                        size: self.size
                on_selection: root.selected_file(*args)
            RstDocument:
                id: document_parameter_viewer

        GridLayout:
            cols: 1
            rows: 1
            height: 30
            size_hint_y: None
            Button:
                id: button_home_visualize
                valign: 'middle'
                halign: 'center'
                text: "Turn to home"
                size: self.texture_size
                on_press: root.go_to_home()

您知道一些避免此解决方案的技巧吗?

解决方案是将FileChooserListView的高度(
self.y-30
)降低按钮/最后一个网格布局的高度(
height:30

片段 输出

        FileChooserListView:
            id: visualize_file_chooser_variables
            canvas.before:
                Color:
                    rgba: hex('#413FBF')
                Rectangle:
                    pos: self.x, self.y - 30
                    size: self.size
            on_selection: root.selected_file(*args)