Hamid
Hamid

Reputation: 3

kivy canvas doesn't shows

I'm trying to have a white background in window and I'm using Kivy modules and Kv language but the background still black.

main.py :

from kivy.app import App
from kivy.uix.floatlayout import FloatLayout


class MyUI(FloatLayout):
    pass

class MyApp(App):
    def build(self):
        return MyUI()


def main():
    MyApp().run()

if __name__ == '__main__':
    main()

my.kv :

<MyUI>:
    canvas:
        Color:
            rgba: 1,1,1,1

Upvotes: 0

Views: 222

Answers (1)

inclement
inclement

Reputation: 29488

Color instructions are applied to shapes that you draw, e.g. if you write the following:

<MyUI>:
    canvas:
        Color:
            rgba: 1,1,1,1
        Rectangle:
            pos: self.pos
            size: self.size

now you will see a white Rectangle filling the screen (as that's what its pos and size are set to do).

Upvotes: 1

Related Questions