• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

python画花

武飞扬头像
青提学编程
帮助1

python可以使用turtle绘制很多图形。很喜欢学生这份配色,还加了创新花瓣。

学新通

 图形绘制,要先做构思。


花瓣由什么组成?


  • 四分之一圆,圆弧 转角 圆弧
  • 循环绘制花瓣,再转角

学新通


添加飘落的花瓣,增加美感


 学新通

 学新通


 代码自取


import turtle
t = turtle.Turtle()

import random

t.speed(10)

t.up()
t.goto(0,-180)
t.down()

t.right(180)

t.pensize(4)
t.color("light green")
t.right(100)
t.circle(200,60)

for x in range(6):
    t.shape("turtle")
    t.begin_fill()
    t.color("pink")
    t.left(30)
    t.circle(60,90)
    t.left(90)
    t.circle(60,90)
    t.end_fill()
    t.color("light blue")
    
#1st   
t.up()    
t.right(90)
t.goto(100,-20)
t.down()
t.begin_fill()
t.color("pink")
t.left(30)
t.circle(30,90)
t.left(90)
t.circle(30,90)
t.end_fill()

#2nd
t.up()    
t.right(90)
t.goto(-150,-100)
t.down()
t.begin_fill()
t.color("pink")
t.left(140)
t.circle(25,90)
t.left(90)
t.circle(25,90)
t.up()
t.end_fill()

#3rd
t.up()    
t.right(200)
t.goto(60,-70)
t.down()
t.up()
t.begin_fill()
t.color("pink")
t.left(30)
t.circle(20,90)
t.left(90)
t.circle(20,90)
t.end_fill()
t.penup()

t.ht()


学新通

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /boutique/detail/tanhggckba
系列文章
更多 icon
同类精品
更多 icon
继续加载