flag果然立不住
距离上次更新应该已经过去了两三周,惭愧……虽然没更新,但总归也还是没闲着,虽然离当初的计划还是有很大差距,但也算跌跌撞撞起步了。
最近有工作、有学习,操作系统算是过了一遍,但印象不深刻;前两天开始了计算机网络,跟工作会有一些关系,慢慢学通了点东西,Python也在断断续续学着,比如今天要分享的微小成果——Shield of Captain America!
turtle库
其实在考研之后的第一阶段Python学习就接触了turtle库,但当时怎么弄都搞不定VSCode的报错,无法调用turtle库。这次破釜沉舟终于搞定了,安装了一个插件——coderunner即可!
今天花了点时间画了个美国队长的盾牌,比较简陋,代码可能距离优美还差很远,颜色还可以再细挑一下,不过好歹实现了。
Talk is cheap, show me the code:
#DrawPython
from turtle import *
# 画圆
def drawRound(size, filled):
pendown()
if filled == True:
begin_fill()
seth(180)
circle(size, 360)
if filled == True:
end_fill()
# 画五角星
def drawFiveangel(size, filled):
pendown()
if filled == True:
begin_fill()
seth(-72)
a = -72
b = 0
for i in range(5):
seth(a - 72 * i)
fd(size)
seth(b - i * 72)
fd(size)
if filled == True:
end_fill()
setup(500, 500)
speed(15)
color("white", "red")
penup()
goto(0, 200)
drawRound(200, True)
penup()
goto(0, 165)
color("white", "white")
drawRound(165, True)
penup()
goto(0, 130)
color("red", "red")
drawRound(130, True)
penup()
goto(0, 95)
color("white", "blue")
drawRound(95, True)
penup()
goto(0, 90)
color("white", "white")
drawFiveangel(65, True)
done()
效果如下:

OK!晚安!