1

I would like to change the background (black color) to a different color in kivy. But the Color specification in kv file is not recognized.

main.py

from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.lang import Builder

class MatrixCalcLayout(BoxLayout):
    def calculations(self):
        pass

class ConfusionMatrixCalcApp(App):
    pass

if __name__ == '__main__':
    ConfusionMatrixCalcApp().run()

ConfusionMatrixCalc.kv file

MatrixCalcLayout:

<MatrixCalcLayout>:
    canvas:
        Color:
            rgba: 0.5, 0.5, 0.5, 0.5
    orientation: 'vertical'
    BoxLayout:
        Label:
    BoxLayout:
        Button:
    BoxLayout:
        Button:
    BoxLayout:
        Button:
KubiK888
  • 4,377
  • 14
  • 61
  • 115

1 Answers1

3

After Color you need to draw something, in your case, a Rectangle

canvas:
    Color:
        rgba: 0.5, 0.5, 0.5, 0.5
    Rectangle: #woohoo!!!
        size: self.size
        pos: self.pos
Yoav Glazner
  • 7,936
  • 1
  • 19
  • 36