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

这是一个10_2电脑的更改
This commit is contained in:
10_2 2025-01-08 10:06:29 +08:00
parent d33e39d894
commit 87d584ed46
1 changed files with 41 additions and 0 deletions

41
2025-1-8-1.py Normal file
View File

@ -0,0 +1,41 @@
import tkinter as tk
import random
import threading
import time
from PIL import Image,ImageTk
class MovingLabel(threading.Thread):
def __init__(self,window,text):
threading.Thread.__init__(self)
self.text=text
self.label=tk.Label(window,image=kuang,text=self.text,compound="center",font=("黑体",20),fg="white",width=190,height=45)
self.label.place(x=800,y=random.randint(10,550))
def run(self):
x=800
while x>-200:
x-=2
self.label.place(x=x)
time.sleep(0.02)
self.label.destroy()
def send():
text=e1.get()
m1=MovingLabel(window,text)
m1.start()
window=tk.Tk()
window.geometry("1000x670")
window.resizable(0,0)
kuang=ImageTk.PhotoImage(file="kuang.png")
bg_image=Image.open("tv.png")
bg_image=ImageTk.PhotoImage(bg_image)
bg_label=tk.Label(window,image=bg_image)
bg_label.pack()
e1=tk.Entry(window,font=("黑体",20))
e1.place(x=280,y=620)
b1=tk.Button(window,text="发送弹幕",font=("黑体",20),command=send)
b1.place(x=580,y=613)
window.mainloop()