from tkinter import *
from tkinter import messagebox
class gui(Frame):
''''''
def __init__(self, master=None):
super().__init__(master)
self.master = master
self.pack()
self.create_lable()
def create_lable(self):
self.label01=Label(self,text='first',width=5,height=2,fg="blue",bg="yellow")
self.label01.pack()
self.btn01 = Button(self, text='first', width=5, height=2, fg="blue", bg="yellow", command=self.start1)
self.btn01.pack()
self.btnquit = Button(self, text='quit', width=5, height=2, fg="blue", bg="yellow", command=root.destroy)
self.btnquit.pack()
self.btn02=Button(self,text="open photo",command=self.photo01)
self.btn02.pack()
def photo01(self):
global photo01
photo01=PhotoImage(file="imgs/b.gif")
self.label02=Label(image=photo01)
self.label02.pack()
def start1(e):
messagebox.showinfo("The system is start;;;;;")
if __name__ == '__main__':
root = Tk()
root.geometry("400x300+800+500")
root.title("My first GUI !")
a = gui(master=root)
root.mainloop()
调用点击按钮图片只能出现一次,如何点击按钮,都会出现?