Kivy - base application has strange alignment

后端 未结 3 907
一生所求
一生所求 2020-12-20 19:29

I am trying to build a basic Kivy app. After adding the basic elements, and running the app, all of the elements are crammed into the bottom left corner. It shows up like th

3条回答
  •  我在风中等你
    2020-12-20 20:15

    I recently wrote a post of a little trick I use when I am programming interfaces. The trick will let you see a border around all the widgets (layouts included) you add to the screen. This would be the result for your code:

    enter image description here

    It takes advantage of inheritance and the Kivy rules to overwrite the base class of all widgets. You just have to add:

    :
        canvas.after:
            Line:
                rectangle: self.x+1,self.y+1,self.width-1,self.height-1
    

    at the beginning of this file:

    :
        FloatLayout:
            BoxLayout:
                orientation: 'vertical'
                spacing: 10
                Label:
                    text: "Enter the path to the folder to open.\nPress OK if you would like to open without a directory"
                TextInput:
                    id: folderpath
                Button:
                    text: 'OK'
    

提交回复
热议问题