1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > 用Python绘制一朵玫瑰花

用Python绘制一朵玫瑰花

时间:2019-08-12 05:24:24

相关推荐

用Python绘制一朵玫瑰花

话不多说,上图:

这是代码,最后会说明怎么把字改成你想要说的

import turtle as tttt.penup()tt.left(90)tt.forward(200)tt.pendown()tt.right(90)#绘制花瓣tt.fillcolor("red")tt.begin_fill()tt.circle(10,180)tt.circle(25,110)tt.left(50)tt.circle(60,45)tt.circle(20,170)tt.right(24)tt.fd(30)tt.left(10)tt.circle(30,110)tt.fd(20)tt.left(40)tt.circle(90,70)tt.circle(30,150)tt.right(30)tt.fd(15)tt.circle(80,90)tt.left(15)tt.fd(45)tt.right(165)tt.fd(20)tt.left(155)tt.circle(150,80)tt.left(50)tt.circle(150,90)tt.end_fill()#花瓣1tt.left(150)tt.circle(-90,70)tt.left(20)tt.circle(75,105)tt.setheading(60)tt.circle(80,98)tt.circle(-90,40)#花瓣2tt.left(180)tt.circle(90,40)tt.circle(-80,98)tt.setheading(-83)#叶子tt.fd(30)tt.left(90)tt.fd(25)tt.left(45)tt.fillcolor("green")tt.begin_fill()tt.circle(-80,90)tt.right(90)tt.circle(-80,90)tt.end_fill()tt.right(135)tt.fd(60)tt.left(180)tt.fd(85)tt.left(90)tt.fd(80)#叶子tt.right(90)tt.right(45)tt.fillcolor("green")tt.begin_fill()tt.circle(80,90)tt.left(90)tt.circle(80,90)tt.end_fill()tt.left(135)tt.fd(60)tt.left(180)tt.fd(60)tt.right(90)tt.circle(200,60)tt.pencolor("red")tt.write("爱你哦!狗妹♥",align="center",font=("宋体",50,"normal"))tt.done()

tt.write("爱你哦!狗妹♥",align="center",font=("宋体",50,"normal"))

在这里进行更改,其中50是字体大小,如果你的字数太多可以适当调小。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。