我一直在努力研究如何使用类,但是每个人使用它们的方式都不一样,这让我感到困惑和困惑。在
我正在尝试将这两个图像插入到一个类中,但不知道如何执行此操作。 另一件我正在努力解决的问题是,如何将我想要销毁的内容放入一个列表中,然后发送到函数中以删除图像,而不是单独执行这些操作?在
如果有人能帮我解释如何做这些事情,或者告诉我如何去做(我通过例子学到了最好的东西,但是我对没有用我的情况的例子感到困惑。)
import sys
from tkinter import *
from PIL import Image, ImageTk
SWH = Tk()
SWH.geometry("1024x950+130+0")
SWH.title("ServiceWhiz.")
#_#GlobalFunction#_
#ClearAllWidgets
def removewidgets(A, B):
A.destroy()
B.destroy()
return;
#_#LoadingPage#_
class SWLoad:
def __init__(self, master):
load = Image.open("Logo.png")
render = ImageTk.PhotoImage(load)
img = Label(SWH,image=render)
img.image = render
img.place(x=458,y=250)
load = Image.open("PoweredByServiceWhiz.png")
render = ImageTk.PhotoImage(load)
img1 = Label(SWH,image=render)
img1.image = render
img1.place(x=362,y=612.5)
img.after(3000, lambda: removewidgets(img, img1) )
我想你想把你的Tkinter应用放在一个类里?应用程序必须显示两个图像,然后再删除它们?在
如果这是正确的,这应该对你有用。我已经在评论中解释了什么是做什么的。在
相关问题 更多 >
编程相关推荐