Assign group name to kivy graphic instruction
<p>This seems like it should be really simple, yet I have failed to find a way to do it.</p>

<p>In order to iterate over the instructions on my canvas, I am supposed to use <code>canvas.get_group()</code> method. In order to do that, I first need to assign a group name to whichever instructions I intend to iterate over. How does one do that?</p>

<p>This is an answer to my own question which I was able to find.</p>

<p>So, i have found (<a href="http://stackoverflow.com/questions/36230958/how-do-i-reference-ids-of-children-within-a-canvas-in-kivy">from here</a>) that Instructions (and many other classes in the canvas scope) have a <code>group</code> property, not listed in the documentation, which can be set when creating the instruction:</p>

<p>like so in python:</p>

<pre><code>with self.canvas: (self must be a widget)
    Rectangle(pos=self.pos, size=self.size, group='my_group')
</code></pre>

<p>and like so in kv:</p>

<pre><code>&lt;SomeWidget&gt;:
    canvas:
        Rectangle:
            group:'my_group'
</code></pre>

<p>When done like so, a later call to <code>self.canvas.get_group('my_group')</code> returns an iterable with the instructions in it.</p>

<p>However this has its own problems. Check my <a href="http://stackoverflow.com/questions/39476837/return-from-canvas-get-group-call-in-kivy">next question</a>.</p>

python kivy kivy-language