Signed-off-by: sairate <sairate@sina.cn>

This commit is contained in:
sairate 2025-01-10 16:40:22 +08:00
parent e680fccb29
commit 0287890380
1 changed files with 6 additions and 6 deletions

12
main.py
View File

@ -1,7 +1,7 @@
import turtle import turtle
import random import random
import time import time
from PIL import Image #from PIL import Image
# 设置屏幕 # 设置屏幕
screen = turtle.Screen() screen = turtle.Screen()
@ -10,11 +10,11 @@ screen.bgcolor("black") # 背景色可以设置为黑色或其他
screen.title("Snowfall Animation") screen.title("Snowfall Animation")
screen.tracer(0) screen.tracer(0)
# 加载 .jpg 图片并转换为 .gif 格式 ## 加载 .jpg 图片并转换为 .gif 格式
image_path = "dy.jpg" #image_path = "dy.jpg"
image = Image.open(image_path) #image = Image.open(image_path)
# 将图片保存为 .gif 格式 ## 将图片保存为 .gif 格式
image.save("dy.gif", "GIF") #image.save("dy.gif", "GIF")
# 设置背景图为 .gif 格式 # 设置背景图为 .gif 格式
screen.bgpic("dy.gif") screen.bgpic("dy.gif")