我刚开始使用python tkinter,我有一个按钮可以打开一个新窗口。一个新窗口有一个图像,但图像不会显示出来。你能帮我解决一下我的问题吗?
from tkinter import *
def nwindow():
nwin = Toplevel()
nwin.title("New Window")
btn.config(state = 'disable')
photo2 = PhotoImage(file = 'funny.gif')
lbl2 = Label(nwin, image = photo2)
lbl2.pack()
def quit():
nwin.destroy()
btn.config(state = 'normal')
qbtn = Button(nwin, text = 'Quit', command = quit)
qbtn.pack()
main = Tk()
main.title("Main Window")
main.geometry("750x750")
photo = PhotoImage(file = 'funny.gif')
lbl = Label(main, image = photo)
lbl.pack()
btn = Button(main, text = "New Winodw", command = nwindow)
btn.pack()
main.mainloop()
答案 0 :(得分:0)
你的编码不起作用但是.mainloop()应该解决你的问题
when Datatype LIKE 'LOINC' then 1 else 0 end as Test1