- 2022tysc0250 的博客
python颜色表
- 2023-8-21 18:12:10 @
真是一个无聊的节日
import turtle as t
t.penup()
t.goto(-315,310)
t.pendown
t.write("By:xjy",align="center",font=("HannotateSC-W5",20,"normal"))
t.Screen().bgcolor("pink")
def arc():
(x,y) = t.pos()
t.goto(x - 5,y - 10)
t.goto(x,y)
def petal():
t.goto(-50,100)
t.pendown()
t.setheading(-40)
t.circle(50,90)
t.fd(20)
t.rt(180)
t.circle(50,-60)
t.circle(150,55)
t.goto(-50,100)
t.setheading(310)
t.circle(50,-90)
t.rt(185)
t.circle(50,65)
t.penup()
t.circle(50,-65)
t.rt(175)
t.circle(50,90)
t.goto(-50,100)
t.pendown()
t.setheading(320)
t.circle(50,-90)
t.rt(185)
t.circle(50,65)
t.rt(340)
t.circle(50,-55)
t.penup()
t.end_fill()
def stem():
t.fillcolor("green")
t.goto(-50,100)
t.begin_fill()
t.pendown()
t.setheading(240)
t.circle(400,10)
t.lt(180)
t.circle(60,90)
t.lt(90)
t.circle(60,90)
t.rt(90)
t.circle(400,30)
t.setheading(0)
t.fd(10)
t.lt(280)
t.circle(400,-20)
t.lt(90)
t.circle(60,90)
t.lt(90)
t.circle(60,90)
t.circle(400,-19.5)
t.penup()
t.goto(-50,100)
t.end_fill()
t.hideturtle()
def haracter():
t.goto(0,-250)
t.color("DeepPink")
t.write("曾经沧海难为水,除却巫山不是云", align="center",
font=("华文新魏",30,"normal"))
t.goto(0,-320)
t.write("取次花丛懒回顾,半缘修道半缘君", align="center",
font=("华文新魏",30,"normal"))
t.pensize(3)
t.fillcolor("red")
t.shape("turtle")
t.showturtle()
t.speed(10)
t.penup()
t.goto(0,200)
t.pendown()
t.begin_fill()
arc()
t.rt(170)
t.circle(40,-90)
arc()
t.rt(90)
t.circle(50,-90)
arc()
t.rt(90)
t.circle(60,-90)
(x,y) = t.pos()
t.goto(x - 12,y - 18)
t.goto(x,y)
t.rt(90)
t.circle(70,-90)
t.rt(90)
t.circle(80,-85)
(x,y) = t.pos()
t.goto(x - 12,y - 18)
t.goto(x,y)
t.penup()
petal()#花瓣
stem()#茎
haracter()#字
t.exitonclick()
import pygame
import time
import math
pygame.init()
screen = pygame.display.set_mode((1000,800))
pygame.display.set_caption("咕咕咕")
def draw(s1,s2):
sx=s1[0]
ex=s2[0]
sy=s1[1]
ey=s2[1]
l = max(abs(sx-ex),abs(sy-ey))
for i in range(l+1):
tx = round(sx+(ex-sx)*i/l)
ty = round(sy+(ey-sy)*i/l)
pygame.draw.rect(screen,(255,0,0),(int(tx),int(ty),1,1))
a = 10
c = 150.0
while True:
print(a)
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
exit(0)
screen.fill((255,255,255))
l=list()
for tx in range(1000):
x = abs((tx-500)/c)
if x*x > 3.3:
continue
y = x**(2/3)+0.9*math.sqrt(3.3-x*x)*math.sin(a*math.pi*x/10)
ty = 400-round(y*c)
l.append((tx,ty))
for i in range(len(l)-1):
draw(l[i],l[i+1])
pygame.display.update()
a+=1