Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use Layout background in kivy language

Tags:

python

kivy

How use kivy language set StackLayout background, in stacklayout.py ,I can't found how to use;

<MainScreen>:
    view: view
    FloatLayout:
        StackLayout:
            orientation: 'lr-bt'
            spacing: 50
            id: view
            pos: 0, 20
            background_color:(1,1,1,1)
            ButtonImage:                                                                                                                                                                                                                    
                image: 'bv_a_pic_confirm'
                callback: root.do_confirm
                no_toggle: True
like image 548
Timothy Avatar asked Dec 16 '22 12:12

Timothy


1 Answers

Layout and Widget classes don't have the property background_color. Instead use canvas:

StackLayout:
    canvas:
        Color:
            rgba: 1, 1, 1, 1
        Rectangle:
            pos: self.pos
            size: self.size
like image 112
Tshirtman Avatar answered Dec 18 '22 10:12

Tshirtman