NFLmusic库文件

This commit is contained in:
2025-01-23 16:47:37 +08:00
parent 7516e1c95d
commit 9b3f1d1654
54 changed files with 3763 additions and 0 deletions

39
nflmusic/test.py Normal file
View File

@ -0,0 +1,39 @@
import tkinter as tk
from itertools import count
from PIL import Image, ImageTk
class AnimatedGIF(tk.Label):
def __init__(self, root, gif_file, *args, **kwargs):
tk.Label.__init__(self, root, *args, **kwargs)
self.root = root
self.gif_file = gif_file
self.frames = []
self.load_gif()
def load_gif(self):
"""Load the GIF frames."""
try:
with Image.open(self.gif_file) as img:
for frame in count(1):
self.frames.append(ImageTk.PhotoImage(img.copy()))
img.seek(frame)
except EOFError:
pass
self.show_animation()
def show_animation(self):
"""Display the animation."""
def update_frame(frame_index):
self.configure(image=self.frames[frame_index])
self.root.after(100, update_frame, (frame_index + 1) % len(self.frames))
update_frame(0)
if __name__ == "__main__":
root = tk.Tk()
gif_label = AnimatedGIF(root, r"C:\Users\Administrator.DESKTOP-0DNOS3E\AppData\Roaming\.NFLmusic\resource\images\loading.gif")
gif_label.pack()
root.mainloop()