Wednesday, February 23, 2011

Turtle Art text to speech

Turtle Art can do text to speech using the Python code block. Enter the following code in Pippy. Load the code by clicking on the python block. Clicking Start will say whatever is plugged into the right of the Python block. The + operator can process strings and numbers.




The following variant from Walter avoids whole numbers (integers) being spoken with a decimal place


As at Turtle Blocks V106, this Python code is included in the inbuilt examples as speak.py

Labels: , , , ,

1 Comments:

Blogger walter said...

One suggested tweak:

# Turtle Art numbers are passed as float, but they may be integer values
if type(x) == float:
if int(x) == x:
x = int(x)

Wednesday, February 23, 2011 11:58:00 PM  

Post a Comment

<< Home