turtle 库练习
Posted wtaure
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了turtle 库练习相关的知识,希望对你有一定的参考价值。
#同切圆 import turtle turtle.circle(10) turtle.circle(20) turtle.circle(30) turtle.circle(40) turtle.circle(50) turtle.circle(60) turtle.circle(70) turtle.circle(80)
import turtle #同心圆 turtle.circle(10) turtle.penup() turtle.goto(0,-10) turtle.pendown() turtle.circle(20) turtle.penup() turtle.goto(0,-20) turtle.pendown() turtle.circle(30) turtle.penup() turtle.goto(0,-30) turtle.pendown() turtle.circle(40) turtle.penup() turtle.goto(0,-40) turtle.pendown() turtle.circle(50) turtle.penup() turtle.goto(0,-50) turtle.pendown() turtle.circle(60) turtle.penup() turtle.goto(0,-60) turtle.pendown() turtle.circle(70) turtle.penup() turtle.goto(0,-70) turtle.pendown() turtle.circle(80)
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)
#黄色五角星 import turtle turtle.color(\'yellow\') turtle.bgcolor(\'red\') 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.end_fill()
#国旗 import turtle turtle.color(\'yellow\') turtle.bgcolor(\'red\') #大五角星 turtle.penup() turtle.goto(-350,210) turtle.penup() 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.end_fill() #四个小五角星 turtle.begin_fill() turtle.penup() turtle.goto(-180,270) turtle.pendown() 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.end_fill() turtle.begin_fill() turtle.penup() turtle.goto(-100,245) turtle.pendown() 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.end_fill() turtle.begin_fill() turtle.penup() turtle.goto(-110,95) turtle.pendown() 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.end_fill() turtle.begin_fill() turtle.penup() turtle.goto(-170,50) turtle.pendown() 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.end_fill()
以上是关于turtle 库练习的主要内容,如果未能解决你的问题,请参考以下文章