Python Turtle库使用

您所在的位置:网站首页 python海龟画图爱心 Python Turtle库使用

Python Turtle库使用

2023-08-16 11:54| 来源: 网络整理| 查看: 265

先上绘制过程,一朵丑萌丑萌的柔丝……↓

接着展示敲代码过程,还是败了几次……

PS:本代码由北理工嵩天老师的《Python语言程序设计》提供

提供

以下是这朵丑萌丑萌的柔丝完整Python代码

(改编自北理工嵩天老师的《Python语言程序设计》程序):

import turtle as t t.penup() t.left(90) t.fd(200) t.pendown() t.right(90)

t.fillcolor("red") t.begin_fill() t.circle(10,180) t.circle(25,110) t.left(50) t.circle(60,45) t.circle(20,170) t.right(24) t.fd(30) t.left(10) t.circle(30,110) t.fd(20) t.left(40) t.circle(90,70) t.circle(30,150) t.right(30) t.fd(15) t.circle(80,90) t.left(15) t.fd(45) t.right(165) t.fd(20) t.left(155) t.circle(150,80) t.left(50) t.circle(150,90) t.end_fill()

t.left(150) t.circle(-90,70) t.left(20) t.circle(75,105) t.setheading(60) t.circle(80,98) t.circle(-90,40)

t.left(180) t.circle(90,40) t.circle(-80,98) t.setheading(-83)

t.fd(30) t.left(90) t.fd(25) t.left(45) t.fillcolor("green") t.begin_fill() t.circle(-80,90) t.right(90) t.circle(-80,90) t.end_fill()

t.right(135) t.fd(60) t.left(180) t.fd(85) t.left(90) t.fd(80)

t.right(90) t.right(45) t.fillcolor("green") t.begin_fill() t.circle(80,90) t.left(90) t.circle(80,90) t.end_fill()

t.left(135) t.fd(60) t.left(180) t.fd(60) t.right(90) t.circle(200,60)  

之后如果有想法了,会把它努力画好点的……

毕竟Python强大的绘图功能不止这些



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3