from tkinter import * from tkinter import messagebox class Application(Frame): def __init__(self,master=None): super().__init__(master) self.master=master self.pack() self.createWidget() def createWidget(self): btn01=Button(self.master,text='ok',command=self.callback) btn01.config(anchor=CENTER) btn01.pack() def callback(self): messagebox.showinfo('*提示*','欢迎进入GUI编程') if __name__ == '__main__': root=Tk() root.geometry('500x300+300+200') app=Application(master=root) root.mainloop()
python 窗体设计的经典写法-使用类
最新推荐文章于 2024-04-05 22:49:40 发布