Фоновое изображение не будет отображаться после добавления панели навигации в Kivy - PullRequest
0 голосов
/ 09 мая 2019

Итак, я создавал приложение и хотел навигационный ящик, поэтому я добавил его. Однако кажется, что я королевский нуб и как-то заставил мой фон экрана исчезнуть. Я попытался возиться с canvas.after, и он, кажется, работает, но он отображает перед экраном текст и кнопки. Я очень новичок в Python и Kivy, поэтому будьте осторожны с вашими ответами!

FloatLayout:
    canvas:
        Rectangle:
            pos: self.pos
            size: self.size
            source: '9.png'


    NavigationDrawer:
        FloatLayout:
            orientation: 'vertical'
            canvas.before:
                Rectangle:
                    pos: self.pos
                    size: self.size
                    source: '9.png'
            Label:
                text: "Navigation Menu"
                pos_hint: {"y": 0.75}
                size_hint: 1, 0.2
                font_size: (root.width**2 + root.height**2) / 14**4
                font_name: "Product Sans.ttf"

            Button:
                text: "Example button"
                pos_hint: {"y":0.66}
                size_hint: 1.1, 0.06
                font_name: "OpenSans.ttf"
                on_release:
                    app.root.current = "Example"
                    root.manager.transition.direction = "right"

            Button:
                text: "Example button 2"
                pos_hint: {"y":0.1}
                size_hint: 1, 0.06
                font_name: "OpenSans.ttf"
                on_release:
                    app.root.current = "Example"
                    root.manager.transition.direction = "right"

        FloatLayout:
            size: root.width, root.height/2
            cols:2
            canvas:
                Rectangle:
                    pos: self.pos
                    size: self.size
                    source: '9.png' 
            Label:
                bold: True
                font_name: 'Product Sans.ttf'
                size_hint: 0.8,0.3
                pos_hint: {"x":0.1, "y":0.75}
                text: "Example"
                font_size: (root.width**2 + root.height**2) / 12**4

            Label:
                font_name: 'OpenSans.ttf'
                size_hint: 0.5,0.12
                pos_hint: {"x":0.08, "top":0.6}
                text: "Example "
                font_size: (root.width**2 + root.height**2) / 14**4

            TextInput:
                pos_hint: {"x":0.5, "top":0.58}
                size_hint: 0.4, 0.08
                id:Example
                multiline:False
                font_size: (root.width**2 + root.height**2) / 14**4

            RippleButton:
                font_name: 'OpenSans.ttf'
                text:"Exampler"
                pos_hint:{"x":0.3,"y":0.20}
                size_hint: 0.4, 0.1
                font_size: (root.width**2 + root.height**2) / 14**4
                on_release:
                    root.folder()

            RippleButton:
                text:"Example"
                font_name: 'OpenSans.ttf'
                pos_hint:{"x":0.3,"y":0.08}
                size_hint: 0.4, 0.1
                font_size: (root.width**2 + root.height**2) / 14**4
                on_release:
                    root.chrome()

            FloatButton:
                id: float_root
                size_hint: (None,None)
                btn_size: (50,50)
                size: (50,50)
                bg_color: (255,255,255,1)
                pos_hint: {'x': 0.01}
                RippleButton: 
                    text: float_root.text
                    markup: True
                    size_hint: (None,None)
                    size: float_root.btn_size
                    pos_hint: {'x': 0.05, 'y': 0.15}
                    background_normal: ''
                    background_color: (0,0,0,0)
                    canvas.before:
                        Ellipse:
                            size: self.size
                            pos: self.pos
                            source: 'LACB.png'
                    on_release:
                        app.root.current = "main"
                        root.manager.transition.direction = "right"

Поэтому, когда я запускаю это, мое фоновое изображение исчезает, и фон теперь становится черным. Любая помощь будет принята с благодарностью!

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...