samedi 14 mars 2015

AttributeError: 'builtin_function_or_method' object has no attribute 'choice'

This is My code



from turtle import *
from random import *

num_blobs = 300
max_coord = 400
max_blob_size = 20
max_dribble_width = 8
chosen_color = ('red', 'green', 'blue', 'yellow', 'orange', 'purple', 'pink', 'black')
setup(max_coord * 2, max_coord * 2)
title("Jackson Polluck's Final Masterpiece")
speed("fastest")
pendown()

for each in range(num_blobs):
random_color = random.choice(chosen_color)
color(random_color)
width(randint(1, max_dribble_width))
goto(randint(-max_coord, max_coord),
randint(-max_coord, max_coord))
dot(randint(1, max_blob_size))

hideturtle()
done()


I am having difficulty choosing a random color for my turtle graphics and am getting the error thats in the name of the question.





Aucun commentaire:

Enregistrer un commentaire