python/2024-9-6-1.py

53 lines
894 B
Python

import turtle
import random
t=turtle.Turtle()
t.speed(0)
def lian(x, y):
t.penup()
t.goto(x, y)
t.pendown()
t.fillcolor("yellow")
t.begin_fill()
t.circle(35)
t.end_fill()
def eyes(x27,y5):
t.penup()
t.goto(x27,y5)
t.pendown()
t.fillcolor("black")
t.begin_fill()
t.circle(6)
t.end_fill()
t.penup()
t.goto(x27, y5+4)
t.pendown()
t.fillcolor("white")
t.begin_fill()
t.circle(2)
t.end_fill()
def zui(x,y):
t.penup()
t.goto(x,y)
t.pendown()
t.setheading(-45)
t.circle(radius=40, extent=90, steps=4) #circle(radius=50,extent=80,steps=5)
def smile(x,y):
lian(x,y)
eyes(x+17,y+40)
eyes(x -17, y + 40)
zui(x-25,y+26)
t.setheading(0)
for i in range(1000):
y = random.randint(-7, 7) * 70
x = random.randint(-6, 6) * 70
smile(x,y)
t.hideturtle()
turtle.done()