1.四个连环的圆
import turtle as t
t.speed(0)#调节速度,0是最快的
t.color('blue')
t.pensize(9)#调节字符粗细
for i in range(0,20):
t.right(91)
t.circle(100)
t.done()
2.奥运五环
import turtle
turtle.width(10)#指定画笔的粗细
turtle.speed(10)#调剂速度
#第一个蓝色的圆
turtle.color("blue")
turtle.circle(50)
#第二个黑色的圆
turtle.penup()#抬笔
turtle.goto(120,0)#圆与圆的距离为20
turtle.pendown()#落笔
turtle.color("black")
turtle.circle(50)
turtle.penup()
turtle.goto(240,0)
turtle.pendown()
turtle.color("red")
turtle.circle(50)
turtle.penup()
turtle.goto(60,-50)
turtle.pendown()
turtle.color("green")
turtle.circle(50)
turtle.penup()
turtle.goto(180,-50)
turtle.pendown()
turtle.color("yellow")
turtle.circle(50)
turtle.done()
3.美国队长
#1.画一个红色的圆圈
import turtle as t
t.color('white')
t.speed(0)
t.penup()
t.goto(0,-200)
t.pendown()
t.begin_fill()#填充一个红色圆
t.circle(200)
t.color('red')
t.end_fill()
#填充白色在一个环里面
t.penup()
t.goto(0,-150)
t.pendown()
t.begin_fill()
t.circle(150)
t.color('white')
t.end_fill()
#填充蓝色的环
t.penup()
t.goto(0,-100)
t.pendown()
t.begin_fill()
t.circle(100)
t.color('blue')
t.end_fill()
#画五角星
t.penup()
t.color('white')
t.goto(-70,10)
t.pendown()
t.begin_fill()
for i in range(5):
t.forward(140)#向前走140米
t.right(144)
t.end_fill()
t.hideturtle()#隐藏箭头
t.done()
4. 气球
import turtle as t
import random #随机数
t.colormode(255)
t.speed(0)
for i in range(20):
red=random.randint(0,255)#0--255的颜色随机选
green=random.randint(0,255)
blue=random.randint(0,255)
x=random.randint(-400,220)#坐标随机
y=random.randint(-400,220)#坐标随机
t.penup()
t.goto(x,y)
t.pendown()
t.begin_fill()
t.circle(50)
t.color(red,green,blue)#三种随机颜色
t.end_fill()
t.right(90)
t.forward(90)
t.left(90)
t.done()