I have a list of RGB values generated from an image:
color_list = [(192, 155, 120), (132, 81, 65), (226, 226, 199), (76, 94, 117), (140, 157, 178), (17, 34, 54),
(217, 213, 139), (134, 171, 144), (98, 123, 95), (109, 145, 96), (181, 109, 92), (71, 47, 39),
(156, 137, 145), (108, 49, 39), (40, 56, 96), (33, 44, 42), (113, 79, 82), (122, 136, 102),
(122, 126, 136), (152, 116, 122), (66, 65, 58), (212, 180, 176), (176, 201, 183), (206, 182, 186),
(179, 190, 208), (59, 66, 61), (89, 50, 52), (171, 200, 209), (74, 42, 43), (110, 133, 142),
(54, 66, 71)]
I need to randomly pull one of those RGB sets to pass on to turtle to make a dot that color, but I can’t seem to find how to pull those values to pass that on.
I’ve tried:
color = random.choice(color_list)
def add_dot(obj):
obj.stamp()
obj.dot(20, color)
But that doesn’t work. I know it’s because I’m not pulling the values correctly, I just can’t find how to do it.
Sean Cannon is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.