Activities/Turtle Art: Difference between revisions
| Line 561: | Line 561: | ||
# | # | ||
########################################################################### | ########################################################################### | ||
r = int(x[0]) | r = int(x[0]) | ||
while r < 0: | while r < 0: | ||
| Line 587: | Line 586: | ||
# | # | ||
########################################################################### | ########################################################################### | ||
try: # make sure x is a number | try: # make sure x is a number | ||
x = float(x) | x = float(x) | ||
except ValueError: | except ValueError: | ||
return | return | ||
if lc.tw.canvas.pendown: | if lc.tw.canvas.pendown: | ||
dist = 0 | dist = 0 | ||
| Line 616: | Line 613: | ||
# | # | ||
########################################################################### | ########################################################################### | ||
if type(x) != str: | if type(x) != str: | ||
X = str(x).upper() | X = str(x).upper() | ||
| Line 633: | Line 629: | ||
# | # | ||
########################################################################### | ########################################################################### | ||
lc.heap.append(localtime().tm_hour) | lc.heap.append(localtime().tm_hour) | ||
lc.heap.append(localtime().tm_min) | lc.heap.append(localtime().tm_min) | ||
| Line 645: | Line 640: | ||
# | # | ||
########################################################################### | ########################################################################### | ||
val = 0.3 * lc.tw.rgb[0] + 0.6 * lc.tw.rgb[1] + 0.1 * lc.tw.rgb[2] | val = 0.3 * lc.tw.rgb[0] + 0.6 * lc.tw.rgb[1] + 0.1 * lc.tw.rgb[2] | ||
if x != 100: | if x != 100: | ||
| Line 663: | Line 657: | ||
# | # | ||
########################################################################### | ########################################################################### | ||
lc.tw.save_as_image(str(x)) | lc.tw.save_as_image(str(x)) | ||
return | return | ||