I've read the questions about how to change a background, add a color, etc. in Kivy, and I'm familiar with how to do that for widgets.
My question is sort of a general strategy of what sort of object is intended to be used when all I want is a background that I'm going to put other widgets on---should that be a label or a widget, or a layout? (Suppose I'm only going to have a small padded background that I'll put a different colored gridlayout on, as in <a href="https://stackoverflow.com/questions/20366779/nesting-widgets-in-kivy" rel="nofollow">this question</a>.)Answer1:
I think the answer is really 'it depends'. As you say, you can add a background to anything, so the decision rests entirely on what kind of other behaviour you want the widget to have.<blockquote>
all I want is a background that I'm going to put other widgets on---should that be a label or a widget, or a layout?</blockquote>
If you want totally no extra behaviour, a
Widget is fine. If you want simple behaviour like having the child automatically placed/size to fill the background widget, then of course a simple layout like
BoxLayout will be ideal. Alternatively, you might want (for instance) the child to be made a little smaller than the background widget in order to get a little border, in which case an
AnchorLayout would be just right. Or for arbitrary proportional behaviour, the
FloatLayout is ideal.
Of course you can see there, the question really comes down to 'do you want layout behaviour', and if so you just pick the layout that does what you want. There's absolutely no limitation and rule, and it's in the design of kivy that you can combine behaviours like this to get precisely what you want.<blockquote>
(Suppose I'm only going to have a small padded background that I'll put a different colored gridlayout on, as in this question.)</blockquote>
In this case, an <a href="http://kivy.org/docs/api-kivy.uix.anchorlayout.html" rel="nofollow">AnchorLayout</a> seems ideal. This lets you set a padding for the child widget, but (by default) it's otherwise centered, so if you make your own AnchorLayout subclass with a background you'll get the border you seem to want.