Answer the question
In order to leave comments, you need to log in
How to change widget background in kivy?
The examples give something similar, but what should I do if I do not specify the exact position of the widgets.
from kivy.graphics import *
with self.canvas:
# Add a red color
Color(1., 0, 0)
# Add a rectangle
Rectangle(pos=(10, 10), size=(500, 500))
with logo_background.canvas:
Color(.29, .46, .66, 1)
Rectangle(pos = logo_background.pos, size = logo_background.size)
Answer the question
In order to leave comments, you need to log in
Found as for me a very crutch solution
class LogoBackground(Label):
def on_size(self, *args):
self.canvas.before.clear()
with self.canvas.before:
Color(.29, .46, .66, 1)
Rectangle(pos=self.pos, size=self.size)
logo = LogoBackground(text = "text", size_hint = (1, .05))
logo = Label(text = "Text", size_hint = (1, .05))
with logo.canvas.before:
Color(.29, .46, .66, 1)
Rectangle(pos=logo.pos, size=logo.size)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question