码迷,mamicode.com
首页 > 其他好文 > 详细

turtle

时间:2017-09-12 13:43:33      阅读:244      评论:0      收藏:0      [点我收藏+]

标签:turtle   class   hid   code   got   end   speed   imp   技术分享   

画一组同切圆

输入

import turtle


turtle.color(red)
turtle.circle(30)
turtle.circle(60)
turtle.circle(90)
turtle.circle(120)
turtle.circle(150)
turtle.circle(180)
turtle.hideturtle()

输出

技术分享

 

 

画一组同心圆

输入

import turtle

turtle.pos()

turtle.color(red)
turtle.begin_fill()
turtle.up()
turtle.goto(0,-10)
turtle.down()
turtle.circle(10)


turtle.color(orange)
turtle.up()
turtle.goto(0,-30)
turtle.down()
turtle.circle(30)

turtle.color(yellow)
turtle.up()
turtle.goto(0,-60)
turtle.down()
turtle.circle(60)

turtle.color(green)
turtle.up()
turtle.goto(0,-90)
turtle.down()
turtle.circle(90)

turtle.color(blue)
turtle.up()
turtle.goto(0,-120)
turtle.down()
turtle.circle(120)

turtle.color(purple)
turtle.up()
turtle.goto(0,-150)
turtle.down()
turtle.circle(150)

turtle.color(pink)
turtle.up()
turtle.goto(0,-180)
turtle.down()
turtle.circle(180)

输出

技术分享

 

 

画一个五角星

输入

import turtle

turtle.forward(100)
turtle.right(144)
turtle.forward(100)
turtle.right(144)
turtle.forward(100)
turtle.right(144)
turtle.forward(100)
turtle.right(144)
turtle.forward(100)
turtle.right(144)
turtle.hideturtle()

输出

技术分享

 

 

 

 

画一个黄色实心五角星

 输入

import turtle
turtle.color(yellow)
turtle.fillcolor(yellow)
turtle.begin_fill()
turtle.forward(100)
turtle.right(144)
turtle.forward(100)
turtle.right(144)
turtle.forward(100)
turtle.right(144)
turtle.forward(100)
turtle.right(144)
turtle.forward(100)
turtle.right(144)
turtle.end_fill()
turtle.hideturtle()

输出

技术分享

 

 

画左上角的五颗五角星

import turtle

turtle.bgcolor(red)
turtle.speed(100)
turtle.pos()
turtle.up()
turtle.goto(-400,200)
turtle.color(yellow)
turtle.fillcolor(yellow)
turtle.begin_fill()
turtle.forward(100)
turtle.right(144)
turtle.forward(100)
turtle.right(144)
turtle.forward(100)
turtle.right(144)
turtle.forward(100)
turtle.right(144)
turtle.forward(100)
turtle.right(144)
turtle.end_fill()
turtle.down()

turtle.up()
turtle.goto(-270,320)
turtle.color(yellow)
turtle.fillcolor(yellow)
turtle.begin_fill()
turtle.right(45)
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.right(144)
turtle.end_fill()
turtle.down()

turtle.up()
turtle.goto(-200,210)
turtle.color(yellow)
turtle.fillcolor(yellow)
turtle.begin_fill()
turtle.right(160)
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.right(144)
turtle.end_fill()
turtle.down()

turtle.up()
turtle.goto(-190,130)
turtle.color(yellow)
turtle.fillcolor(yellow)
turtle.begin_fill()
turtle.left(0)
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.right(144)
turtle.end_fill()
turtle.down()

turtle.up()
turtle.goto(-250,60)
turtle.color(yellow)
turtle.fillcolor(yellow)
turtle.begin_fill()
turtle.right(20)
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.right(144)
turtle.end_fill()
turtle.down()

turtle.hideturtle()

输出

技术分享

 

turtle

标签:turtle   class   hid   code   got   end   speed   imp   技术分享   

原文地址:http://www.cnblogs.com/xxxiaoxiannv/p/7509400.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!