Maybe using canvas.
canvas.before:
Rectangle:
pos: self.pos
size: self.size
source: self.image
self.image would be the prop that stores the image path.
--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
class MyLabel(Label):
def __init__(self, *args, **kwargs):
image = StringProperty()
super(MyLabel, self).__init__(*args, **kwargs)
with self.canvas.before:
Rectangle(source='imagefile.png', pos=self.pos, size=self.size)
Maybe using canvas.
canvas.before:
Rectangle:
pos: self.pos
size: self.size
source: self.image
It appears that self.pos is [0, 0] in some, if not all, Layout managers- for example the StackLayout. Is this a known fact?Is there any dimension that follows a widget when it has been placed in a layout manager? There must be... otherwise Button's could not be created with a background image.I notice that center_x and center_y are non-zero... do I need to follow them to get the Labels' backgrounds to be placed properly?
--
with self.canvas.before:
self.rect = Rectangle(source=self.image, pos=self.pos, size=self.size)
# listen to size and position changes