Reputation: 4694
Whenever I try to span the canvas across the layout, all I have to do is this
<FloatLayout>:
canvas:
Color:
rgba: 54 / 255, 60 / 255, 72 / 255, 1
Rectangle:
pos: self.pos
size: self.size
I have been playing around and fail to understand what is self.pos referring to? By reading the documentation it seems the it points to current widget which should be Rectangle. However when I enter the debug mode, I notice that the default value of self.size is (100, 100).
Upvotes: 3
Views: 3286
Reputation: 5947
Rectangle is not a widget, it's a canvas instruction, a widget is representation (a set of canvas instructions) + behavior (various methods like 'on_touch_down'). in kv, self always designate the current widget, so here, FloatLayout.
Widget's default size is indeed '(100, 100)' it's a default as good as any.
Upvotes: 6
Reputation: 12189
Default size of a widget is 100x100 and pos [0,0]. And Rectangle
is not a widget, but an instruction on canvas
. So you used an instruction to draw something on a canvas
of a widget, which is by default 100x100 at [0,0].
Upvotes: 4