Background color by itself, no. You'll still need to change it inside another widget or something similar. But if you use a picture of one color, then it is!
Label
doesn't have a background by itself, that's why you can use its canvas
to put it there, otherwise it's transparent. If it's transparent, that means it can show a content of another widget e.g. the one that's under it.
So put under it Image
and you have basically the whole canvas
+ Rectangle
with source
thing, but separated into two widgets. If you want to change only background color, open e.g. mspaint
, fill it with a single color and load with Python.
It might not work with BoxLayout
correctly, because it handles position of its children automatically, but with FloatLayout
that's not a problem anymore:
from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.image import Image
from kivy.uix.floatlayout import FloatLayout
class MyApp(App):
def build(self):
flt = FloatLayout()
image = Image(size_hint=(None, None), size=(300, 300),
source=<path to image>)
label = Label(size_hint=(None, None), size=(300, 300),
text='Hello World')
flt.add_widget(image)
flt.add_widget(label)
return flt
MyApp().run()