Activities/Turtle Art: Difference between revisions
| Line 539: | Line 539: | ||
==Programmable Brick== | ==Programmable Brick== | ||
The following | The following feature—a block that can be programmed by the Pippy activity—is available in versions 44+ of Turtle Art. | ||
A copy of the tamyblock.py module is stored in the Journal when you first launch Turtle Art. You can edit the module in Pippy and then import your custom code into Turtle Art using the Pippy button on the Activity toolbar. | |||
A copy of the tamyblock.py module is stored in the Journal when you first launch Turtle Art. You can edit the module in Pippy and then import your custom code into Turtle Art using the Pippy button. | |||
[[Image:TAPippyButton.svg]] | [[Image:TAPippyButton.svg]] | ||
| Line 550: | Line 547: | ||
[[Image:TA-pippy.png|300px]] | [[Image:TA-pippy.png|300px]] | ||
To use the customized block, select the " | To use the customized block, select the "Pippy" block found on the the Extras palette. | ||
Examples: | Examples: | ||
[[Image:TA-dotted-line.png]] | |||
def myblock(lc, x): | def myblock(lc, x): | ||
########################################################################### | ########################################################################### | ||
| Line 577: | Line 577: | ||
return | return | ||
You can pass a list of up to three arguments to tamyblock.py as in the example below that converts the input to an rgb value. | |||
[[Image:TA-rgb.png]] | |||
def myblock(lc, x): | def myblock(lc, x): | ||
| Line 605: | Line 605: | ||
lc.tw.fgcolor = lc.tw.cm.alloc_color(rgb) | lc.tw.fgcolor = lc.tw.cm.alloc_color(rgb) | ||
return | return | ||
def myblock(lc, x): | def myblock(lc, x): | ||