Advertisement

python奥运五环_Python绘制奥运五环

阅读量:

绘制奥运五环主要涉及到Python中的turtle绘图库运用:

turtle.forward(distance)

向当前画笔方向移动distance像素长度

turtle.backward(distance)

向当前画笔相反方向移动distance像素长度

turtle.right(degree)

顺时针移动degree°

turtle.left(degree)

逆时针移动degree°

turtle.pendown()

移动时绘制图形,缺省时也为绘制

turtle.goto(x,y)

将画笔移动到坐标为x,y的位置

turtle.penup()

提起笔移动,不绘制图形,用于另起一个地方绘制

turtle.circle()

画圆,半径为正(负),表示圆心在画笔的左边(右边)画圆

setx( )

将当前x轴移动到指定位置

sety( )

将当前y轴移动到指定位置

setheading(angle)

设置当前朝向为angle角度

home()

设置当前画笔位置为原点,朝向东。

dot(r)

绘制一个指定直径和颜色的圆点

程序源代码为:

复制代码
import turtle

turtle.width(10)

turtle.color('black')

turtle.circle(50)

turtle.penup()

turtle.goto(120,0)

turtle.pendown()

turtle.color('red')

turtle.circle(50)

turtle.penup()

turtle.goto(240,0)

turtle.pendown()

turtle.color('blue')

turtle.circle(50)

turtle.penup()

turtle.goto(60,-50)

turtle.pendown()

turtle.color('yellow')

turtle.circle(50)

turtle.penup()

turtle.goto(180,-50)

turtle.pendown()

turtle.color('pink')

turtle.circle(50)

#Python绘制奥运五环

运行后,结果为:

L3Byb3h5L2h0dHBzL2ltZzIwMTguY25ibG9ncy5jb20vYmxvZy8xNjQwMTI0LzIwMTkwNC8xNjQwMTI0LTIwMTkwNDA1MjEyMDE0MDg2LTIxMzM0Njc5MzYucG5n.jpg

Python 学习记录----利用Python绘制奥运五环

Import the turtle module. Import the turtle module for use in this program. Import the turtle module and utilize it for drawing purposes. Set the color to blue. Set the pen color to blue. Set the color of the drawing tool to blue. Lift the pen up using penup(). Use penup() and pendown() commands to control drawing mode.

【MATLAB】用MATLAB绘制奥运五环

今日利用MATLAB软件进行奥运五环的设计工作。哦,实际上是为了完成他人作业而进行的协助工作。贴代码如下:clear;clc;N=1000;angle=linspace(…);

canvas一周一练 -- canvas绘制奥运五环(1)

运行效果:

python使用turtle库绘制奥运五环

图形效果:绘制 Olympic 五环并初始化绘图环境
import turtle
turtle.setup(1.0, 1.0) # 设置窗口大小
turtle.title('奥运五环') # 赋予窗口名称
turtle.pen ...

第一讲:使用html5——canvas绘制奥运五环

初识canvas

使用turtle库绘制奥运五环

import turtle as t t.setup(600,600,50,50) t.pensize(3) t.pencolor("red") t.penup() t.pendo ...

python3 turtle画正方形、矩形、正方体、五角星、奥运五环

在Python 3开发环境中使用tortoise模块依次绘制包括正方形、矩形、立方体、五角星以及奥运五环

Python绘制PDF文件~超简单的小程序

项目简介部分:本次项目较为简单

Python绘制3d螺旋曲线图实例代码

Axes3D.plot(xs, ys, *args, **kwargs) 用于生成二维和三维图表 参数列表 该函数接受多个可选参数以自定义输出效果 xs和ys分别指定X轴和Y轴上的数据点位置 zs表示每个三维点的高度值,默认情况下每个点的高度为1 zdir则用于指明在绘制二维图形时如何投影这些三维数据 ...

随机推荐

WinForm------GridControl的部分属性介绍

请参阅以下链接:http://www.cnblogs.com/djian/archive/2010/11/19/1881579.html //请注意:在定义GridControl中的FileName属性时 ...

数据库知识整理<;五>;

基本的数据检索操作:在第5章1节中讨论了数据库查询的核心架构。子查询中的字段选择项可选包括聚合函数(如distinct)以及字段名称或别名(如*或column[alias])。源自表格数据的SQL语句将基于指定条件筛选记录。

[Android新手区] SQLite 操作详解--SQL语法

这篇文章完全摘自:北大青鸟[Android新手区]《SQLite 操作详解》--SQL语法:http://home.bdqn.cn/thread-49363-1-1.html SQLite库能够解决...

Camelot_floyd&;&;DP

Run time limit is set to one second (Time Limit: 1s), memory limit is configured to one megabyte (Memory Limit: 64MB), total submissions reach over three thousand (Total Submissions: ~3,289), with more than a thousand cases successfully passed (Accepted ~2,898). Problem description follows.

iOS开发者需要的5款排版工具

Attributed String Creator is a tool that can generate native Objective-C code snippets from formatted text. It allows you to import, paste, or directly create code from your text.

poj 1200 crasy search

题意: 给定一个字符串s,确定其所有长度为n的连续子串中包含的不同字符数量为nc,请求计算该字符串中共存在多少种不同的长度为n的连续子串. 思路: 首先分析问题的基本要素及其相互关系. 然后考虑如何高效地枚举所有可能存在的长度为n的连续子串并统计其中包含的不同字符数量. 最后评估所采用算法的时间复杂度以确保其可行性.

Phonics 自然拼读法 s,a,t,i,p,n Teacher:Lamb

音节(syllables)分解 # 分解练习 # 利奥德分类系统——"七步骤指南" # 发音分析方法 # s,a,t,i,p,n S A T I P N # 自然拼音组合训练表 a mat ...

TERMIOS详解【转】

源自: TERMIOS NAME termios, tcgetattr, tcset ...

hdu 5038 (2014北京网络赛G 排序水题)

题意:给定一组包含n个数字的数据集D,在计算每个数字对应的分数值F(ai)=10^4 - (10^2 - ai)^2后(其中ai表示数据集D中的第i个元素),将计算出的所有分数值进行统计分析以确定最高频次对应的数值;若存在多个具有最高频次的数值,则需按照数值从小到大的顺序依次返回;特别地,在所有返回结果均为最高频次的情况下,则需返回特殊标记Bad标记

傲游浏览器---自定义 UserAgent 字符串

Visit the Maxthon browser at http://www.maxthon.cn/. Customize your User Agent for mobile devices via http://www.fynas.com/ua. Explore the Mobile Device User Agent Repository for comprehensive listings on Various Devices, Operating Systems, and Browsers.

全部评论 (0)

还没有任何评论哟~