1

I get a File "<string>", line 5, in dot turtle.Terminator error whenever I try to draw a dot in turtle python. I am trying to draw a dot from a list of rgb colors.

import turtle
import random


list = [(225, 156, 75), (33, 95, 140), (127, 184, 208), (222, 207, 106), (25, 52, 73), (223, 78, 51), (165, 21, 43), (142, 98, 42), (183, 47, 80), (125, 196, 140), (206, 129, 158), (37, 134, 48), (103, 11, 55), (206, 91, 106), (139, 178, 46), (146, 207, 222), (54, 54, 84), (76, 31, 23), (28, 156, 170), (9, 79, 116), (83, 73, 40), (227, 181, 160), (220, 174, 183), (160, 208, 177), (86, 159, 111), (107, 123, 156)]

choice = random.choice(list)

tim = turtle.Turtle
turtle.colormode("rgb")
screen = turtle.Screen()
screen.exitonclick()

turtle.dot(90,random.choice(list))
duckboycool
  • 2,425
  • 2
  • 8
  • 23
YAKOBISAAC
  • 17
  • 4
  • 1
    `screen.exitonclick()` will wait until the window has been closed. After the window has been closed, there's nowhere to draw a dot. – jasonharper Aug 10 '22 at 14:48
  • 1
    Does this answer your question? [Python Turtle.Terminator even after using exitonclick()](https://stackoverflow.com/questions/45534458/python-turtle-terminator-even-after-using-exitonclick) – ggorlen Aug 10 '22 at 14:59

1 Answers1

1

I tested out your code and shuffled some statements around to have it display a dot. Following is a snippet of code that follows the spirit of your project.

import turtle
import random

list = [(225, 156, 75), (33, 95, 140), (127, 184, 208), (222, 207, 106), (25, 52, 73), (223, 78, 51), (165, 21, 43), (142, 98, 42), (183, 47, 80), (125, 196, 140), (206, 129, 158), (37, 134, 48), (103, 11, 55), (206, 91, 106), (139, 178, 46), (146, 207, 222), (54, 54, 84), (76, 31, 23), (28, 156, 170), (9, 79, 116), (83, 73, 40), (227, 181, 160), (220, 174, 183), (160, 208, 177), (86, 159, 111), (107, 123, 156)]

choice = random.choice(list)

# set the colormode to 255 (rgb)
turtle.colormode(255)
# set color
turtle.color(choice[1], choice[0], choice[2])
# display the random color dot  
turtle.dot(60)

screen = turtle.Screen()
screen.exitonclick()  

Here is a sample screen from executing the program.

Sample Dot

Give that a try.

NoDakker
  • 3,390
  • 1
  • 10
  • 11