首页热点问题发现等你来答
我要提问

为啥报错(python)

提问时间:2023-12-26 06:11 | 栏目 分享 举报已浏览【1083】次


import turtle as ttime.sleep(10)
def watermelon(t, width, height, p_color="green", f_color="red"):
t.penup()
t.goto(0 - width / 2, 0 - height / 2)
t.pendown()
t.pensize(40)
t.pencolor(p_color)
t.fillcolor(f_color)
t.begin_fill()
for i in range(2):
t.forward(width)
t.left(90)
t.forward(height)
t.left(90)
t.forward(20)
t.end_fill()
def seed(t, x, y, r, c):
t.penup()
t.goto(x, y)
t.pendown()
t.color(c)
t.begin_fill()
for i in range(2):
t.circle(r, 90)
t.left(90)
t.end_fill()
def seeds(t, r=20, c="black"):
y = 120
for i in range(1, 5):
x = -240
for j in range(1, 7):
seed(t, x, y, r, c)
x = x + 90
y = y - 90
p1 = t.Turtle
#p1.hideturtle()
p2 = t.Turtle
#p2.hideturtle()
watermelon(p1, 600, 400, "lightgreen", "pink")
seeds(p2, c="yellow")

匿名网友 2023-12-26 06:14 精选回答

程序不止一个错,用变量设置不合理首先少了importtime#没有time模块,不能用time.sleep(10)的二是,既然用了importturtleast,怎么还要用p1=t.Turtle直接用p1=t就可以了同样p2=t.Turtle也要改为p2=t(其实p1,p2都可以不用的)最后不合理的是time.sleep(10)应该是放在程序最后,而不是在头上程序结果:

站长郑重提示:以上回答来自互联网网友,仅其代表个人观点,请谨慎参阅。

找大学安徽淮北的

淮北煤炭师范大学
1752 阅读 71 点赞

高三题目很...

a=0.03平均得分=(62.5+2*67.5+3*72.5+6*77.5+4*82.5+3*87....
1641 阅读 50 点赞

高中作文不少于80词

TitanicisalovestoryaboutJackandRose.Theywerehappy&...
2051 阅读 74 点赞

12306院级信息填写

从电脑上进入官网添加信息来看,院系非必填项,可以不填的。
3194 阅读 119 点赞

四级报名照片的标准尺寸到底咋调

1、Photoshop打开图片。  2、点击右侧的裁剪工具。 &nbs...
7055 阅读 118 点赞
最新问答
1电大中专学历是被国家承认吗? 119 阅读 · 3 点赞
2老师遇到在初中孩子范错误时,问什么都不回答怎么办? 78 阅读 · 8 点赞
3浙江音乐学院作曲与作曲技术理论招多少人? 106 阅读 · 8 点赞
4河北省考警校的话在校考察表和档案考察表从哪里下载? 165 阅读 · 15 点赞
5西安思源学院食堂怎么样?食堂饭菜好吃吗 134 阅读 · 5 点赞
6邯郸电大中专报名流程详细? 123 阅读 · 3 点赞