如题所述
全部代码如下列出, 使用的是python3。
可以作为参考,这个代码比较简单,是用圆形来近似地画一个苹果。
可以复制代码,我把缩进也打进去了,因此我加上了网页链接,目的地是菜鸟教程(不过与本题无关,[doge])
from turtle import *
def leaf(radius,an=90,co="green",co1="green"):
width(3)
color(co,co1);
pass
begin_fill()
circle(radius/2., an)
end_fill()
def stem(radius):
color("")
right(90)
fd(radius)
color("brown")
right(0)
width(9)
circle(radius*5,-19)
def pulp(radius):
pass#果肉
circle(radius);
color("white")
left(90)
fd(0.24/0.84*radius)
circle(1.32/0.84*radius);
color("");
home()
fd(radius*5/4/9);
fd(radius*2);
right(180);
fd(0.16/0.84*radius)
right(-90)
circle(0.48/0.84*radius);
fd(0.13/0.37*radius)#0.13
bk(0.06/0.43*radius)
left(90);
def main():
speed="fast";
aplfr=160;
reset()
#yin(200, "black", "white")
#yin(200, "white", "black")
ht();
home();
fd(aplfr/9.);
rt(90);
#fd(aplfr/9)
color("red")
strt=pos()
pulp(aplfr*2/2.5)#0.84
setpos(strt)
stem(40)
left(180-80);#init as 0
st();
leaf(aplfr)
return "Done!"
if __name__ == '__main__':
main()
mainloop()
有代码吗?