初学者,数据都是自己拼凑的,这是我的代码,真的不会了
from turtle import*
color("red","yellow")#
speed(50)
begin_fill()
while True:
forward(200)
left(170)
if abs(pos())<1:
break
end_fill()
penup()
goto(90,-45)
pensize(3)
pencolor("green")
pendown()
seth(270)
fd(26)
circle(-100,40)
circle(200,45)
color("green","green")
begin_fill()
penup()
goto(45,-170)
pendown()
seth(320)
circle(77,99)
penup()
goto(45,-170)
pendown()
seth(59)
circle(-77,99)
penup()
goto(45,-170)
pendown()
seth(221)
circle(-77,99)
penup()
goto(45,-170)
pendown()
seth(120)
circle(77,99)
end_fill()
Python,turtle库中填充颜色为什么没有在规定的区域内?
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
1条回答 默认 最新
- weixin_46543738 2020-03-16 11:30关注
我也是新手turtle学的时候只学了比较基本的,这是我修改后的代码,总而言之就是你的最后一个begin_fill放早了,空白处是原本你写的begin_fill,我把他往下挪了点位置就ok了,你自己理解下。
import turtle as t
t.color("red","yellow")
t.speed(40)
t.begin_fill()
while True:
t.forward(200)
t.left(170)
if abs(t.pos())<1:
break
t.end_fill()
t.penup()
t.goto(90,-45)
t.pensize(3)
t.pencolor("green")
t.pendown()
t.seth(270)
t.fd(26)
t.circle(-100,40)
t.circle(200,45)
t.color("green","green")t.penup()
t.goto(45,-170)
t.pendown()
t.begin_fill()
t.seth(320)
t.circle(77,99)
t.penup()
t.goto(45,-170)
t.pendown()
t.seth(59)
t.circle(-77,99)
t.penup()
t.goto(45,-170)
t.pendown()
t.seth(221)
t.circle(-77,99)
t.penup()
t.goto(45,-170)
t.pendown()
t.seth(120)
t.circle(77,99)
t.end_fill()t.done()
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 1无用
悬赏问题
- ¥30 Matlab打开默认名称带有/的光谱数据
- ¥50 easyExcel模板 动态单元格合并列
- ¥15 res.rows如何取值使用
- ¥15 在odoo17开发环境中,怎么实现库存管理系统,或独立模块设计与AGV小车对接?开发方面应如何设计和开发?请详细解释MES或WMS在与AGV小车对接时需完成的设计和开发
- ¥15 CSP算法实现EEG特征提取,哪一步错了?
- ¥15 游戏盾如何溯源服务器真实ip?需要30个字。后面的字是凑数的
- ¥15 vue3前端取消收藏的不会引用collectId
- ¥15 delphi7 HMAC_SHA256方式加密
- ¥15 关于#qt#的问题:我想实现qcustomplot完成坐标轴
- ¥15 下列c语言代码为何输出了多余的空格