石泊远 发表于 2020-8-1 20:18:54

我要画一个动态的太极图,但是老是报错,求大神

本帖最后由 石泊远 于 2020-8-1 20:28 编辑


from turtle import *

#def
def gotoa(x,y):
    penup()
    goto(x,y)
    pendown()

a = int(input('请输入:'))

#set
speed(10000000000)
pensize(3)
ht()

begin_poly
fillcolor('black')
begin_fill()
circle(a,180)
circle(2*a,180)
circle(a,-180)
end_fill()

fillcolor('white')
begin_fill()
gotoa(0,3/4*a)
circle(-a/4,360)
end_fill()
fillcolor('black')

gotoa(0,-2*a)
setheading(0)
circle(2*a,180)

begin_fill()
gotoa(0,-3/4*a)
setheading(180)
circle(a/4,360)
end_fill()
end_poly()

myshape = get_poly()
register_shape('newshape',myshape)   #报错的地方
clear()
st()
shape('myshape')
while True:
    right(1)

sunrise085 发表于 2020-8-1 20:40:25

第17行漏掉了括号,begin_poly()
第47行拼写错误,shape('newshape')
页: [1]
查看完整版本: 我要画一个动态的太极图,但是老是报错,求大神