[英]How to create circle and triangle with specific colour using turtle in python?
import turtle
import math
import random
import os`
player = turtle.Turtle()
player.color("yellow")
player.shape("triangle")
player.penup()
player.speed(0)`
maxGoals = 10
goals = []
for count in range(maxGoals):
goals.append(turtle.Turtle())
goals[count].color("red")
goals[count].shape("circle")
goals[count].penup()
goals[count].speed(0)
goals[count].setposition(random.randint(-290,290),random.randint(-290,290))`
运行此代码时,我只得到circle's outline in Red color
的circle's outline in Red color
和triangle's outline in Yellow color
的triangle's outline in Yellow color
我需要circle filled with red color
的circle filled with red color
和triangle filled with Blue color
的triangle filled with Blue color
。 我已包含以下图片:
请帮助我解决此问题
因此,这个问题已经出现过好几次了,但是不幸的是,我今天早上只能找到一个问题: 乌龟不会画斜线
答案似乎始终是图形驱动程序问题。 一旦更正,一切就会按预期开始。 抱歉,我不能更具体,但这取决于您系统的设置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.