Activities/Turtle Art/Under the hood: Difference between revisions
→Modifying Turtle Art: updated instructions for modifying TA |
|||
| Line 57: | Line 57: | ||
help_string=_('turns the turtle 180 degrees')) | help_string=_('turns the turtle 180 degrees')) | ||
Next, you need to define what your block will do: def_prim takes 3 arguments: the primitive name, the number of arguments—0 in this case—and the function to call—in this case, the canvas.seth function to set the heading. | |||
self.tw.lc.def_prim('uturn', 0, | self.tw.lc.def_prim('uturn', 0, | ||
lambda self: self.tw.canvas.seth(self.tw.canvas.heading + 180)) | lambda self: self.tw.canvas.seth(self.tw.canvas.heading + 180)) | ||