我正在尝试制作一个游戏,在游戏结束时我希望它弹出一个窗口,上面写着“你是”,然后当你关闭该窗口时,或者可能在一段时间后,它会打开另一个窗口性格这是我尝试过的:
def Youare():
You_are= Toplevel()#I have tried making this Tk() as well
You_are.geometry('+700+100')
says = Label(You_are,text ='You are....',font=('Helvetica',74))
says.pack(side=BOTTOM)
You_are.mainloop()#If I take this out both windows display at the same time
def Percy():
Percy= Toplevel()
Percy.geometry('450x450')
says = Label(Percy,text ='We were just looking at maps')
says.pack(side=BOTTOM)
img = ImageTk.PhotoImage(Image.open('C:/Users/Geekman2/Pictures/Pictures/Percy.jpg'))
image1 = Label(Percy,image=img)
image1.pack()
Percy.mainloop()
Youare()
Percy()
如果您使用主循环运行 Youare,则 Percy() 将在主窗口关闭之前运行,如果您在没有主循环的情况下运行它,它们会同时显示,从而消除悬念。我究竟做错了什么?