用python函数画德国国旗代码_用Python绘制一面国旗
import turtle as tu
tu.hideturtle() #隐藏海龟
tu.speed(10)
tu.title("Chinese National Flag.") #显示海龟绘图窗口的标题栏文本
n = float(tu.textinput("N","Please enter the times you want.")) #国旗放大的倍数,textinput()函数用于返回用户输入的参数
#旗面
tu.penup()
tu.goto(-150*n,100*n)
tu.pendown()
tu.pencolor("red")
tu.begin_fill()
tu.fillcolor("red")
tu.fd(300*n)
tu.right(90)
tu.fd(200*n)
tu.right(90)
tu.fd(300*n)
tu.right(90)
tu.fd(200*n)
tu.end_fill()
#大星星
tu.penup()
tu.goto(-100*n,80*n)
tu.pendown()
tu.pencolor("yellow")
tu.begin_fill()
tu.fillcolor("yellow")
tu.setheading(-72)
for i in range(5):
tu.fd(57.06*n)
tu.right(144)
tu.end_fill()
#小星星1
tu.penup()
tu.goto(-60*n,70*n)
tu.pendown()
tu.pencolor("yellow")
tu.begin_fill()
tu.fillcolor("yellow")
tu.setheading(70)
for i in range(5):
tu.fd(19.02*n)
tu.right(144)
tu.end_fill()
# 小星星2
tu.penup()
tu.goto(-40*n,63*n)
tu.pendown()
tu.pencolor("yellow")
tu.begin_fill()
tu.fillcolor("yellow")
tu.setheading(10)
for i in range(5):
tu.fd(19.02*n)
tu.right(144)
tu.end_fill()
#小星星3
tu.penup()
tu.goto(-36*n,25*n)
tu.pendown()
tu.pencolor("yellow")
tu.begin_fill()
tu.fillcolor("yellow")
tu.setheading(70)
for i in range(5):
tu.fd(19.02*n)
tu.right(144)
tu.end_fill()
# 小星星4
tu.penup()
tu.goto(-60*n,20*n)
tu.pendown()
tu.pencolor("yellow")
tu.begin_fill()
tu.fillcolor("yellow")
tu.setheading(-20)
for i in range(5):
tu.fd(19.02*n)
tu.right(144)
tu.end_fill()
tu.done()
用python函数画德国国旗代码_用Python绘制一面国旗相关推荐
- 用python函数画德国国旗代码_用Python的turtle模块画国旗
最近在学Python,发现Python的海龟绘图非常有趣,就分享一下!话不多说,先来Python turtle的官方文档链接: Python turtle.这里面有turtle的各类指令.turtle ...
- python画pr曲线代码_利用Python中的numpy包实现PR曲线和ROC曲线的计算
闲来无事,边理解PR曲线和ROC曲线,边写了一下计算两个指标的代码.在 python 环境下,sklearn里有现成的函数计算ROC曲线坐标点,这里为了深入理解这两个指标,写代码的时候只用到numpy ...
- python turtle画彩虹的代码_Python使用turtle绘制国旗,Python图片转换位字符画
这篇文章主要是整合一些趣味代码,一方面自己对这些内容比较感兴趣,另一方面希望这些代码能提升大家的编程兴趣. 一.Python使用turtle绘制国旗 代码如下: 运行结果如下所示,它是动态绘制过程. ...
- python发邮件给女朋友代码_用python讨好女朋友是什么个操作?
原标题:用python讨好女朋友是什么个操作? 文章发布于公号[数智物语] (ID:decision_engine),关注公号不错过每一篇干货. 转自 |数据团学社(微信搜索metrodata_xue ...
- python turtle画有趣的图形_使用python Turtle库画出“精美碎花小清新风格树”
Turtle库手册可以查询查询 使用Turtle画树,看了一下网上的代码,基本上核心的方法是使用递归:其次通过递归传参更笔的粗细从而改变绘制时的线段,更改树的躯干大小,在遍历到最后一个节点时,更改笔的 ...
- 用python函数画德国国旗代码_每日一程-11.利用Python turtle库绘制国旗
Author: Notus(hehe_xiao@qq.com) Create: 2019-02-19 Update: 2019-02-19 利用turtle模块绘制五星红旗 原理不算太复杂,只是需要稍 ...
- 用python函数画德国国旗代码_使用Python的turtle模块画国旗
Python的turtle模块画国旗主要用到两个函数:draw_rentangle和draw_star. 至于函数的调用就和我们学的C,C++是一样的.对于turtle画国旗的程序中,首先是查找国旗的 ...
- 用python函数画德国国旗代码_用python画个五星红旗
importturtle turtle.bgcolor("red") turtle.fillcolor("yellow") turtle.color('yell ...
- 用python函数画德国国旗代码_求一段python中用class方法绘制国旗的代码!记得不是常见的海龟做法!这个星期给我再加送财富点!...
展开全部 from matplotlib import patches, pyplot as plt from math import sin, cos, pi fig = plt.figure(fi ...
最新文章
- 干货 | 只有100个标记数据,如何精确分类400万用户评论?
- 医失眠灵验方--五味子50g 茯神50g 合欢花15g 法半夏15g
- python之super
- 【完结篇】专栏 | 基于 Jupyter 的特征工程手册:特征降维
- redhat 中配置静态 IP
- php 遍历数组 只显示1个,求高手指点,foreach遍历三维数组时只能遍历出第一个子级,这是为什么呢?...
- 拓端tecdat|matlab对MCMC贝叶斯方法用于加筋复合板的冲击载荷识别
- 【USACO 4.3.2】质数方阵
- java如何看手机型号,基于JAVA代码 获取手机基本信息(本机号码,SDK版本,系统版本,手机型号)...
- win7原版iso镜像下载 windows7官方原版全系列(正式版、专业版、企业版、家庭版)下载
- 手机斗鱼服务器无响应,win7看斗鱼直播很卡怎么办|win7斗鱼未响应的解决方法
- maven的scm插件介绍及使用示例
- arduino mega针脚_Arduino MEGA中文数据手册
- Lesson 6英语句子的种类(简单并列复合句)
- windows注册表启动项
- Self-supervised Heterogeneous Graph Neural Network with Co-contrastive Learning
- 二维码名片的生成与读取
- 发光二极管 正向压降
- Go语言实现企业微信sdk,集成了第三方应用sdk和自建应用代开发的sdk,支持一键生成新sdk
- 4K高清屏幕保护工具Aquarium 4K for Mac