代碼:
"""
__project_ = 'python'
__file_name__ = 'test4'
__author__ = 'Administrator'
__time__ = '2019/11/4 9:09'
__product_name = PyCharm
#
"""
from tkinter import *
from tkinter.messagebox import *
class BaseDesk():
def __init__(self,master):
self.master = master
self.master.config()
self.master.title('Base Desk')
self.master.geometry('280x280')
AppMain(self.master,)
class AppMain():
def __init__(self,master):
self.master = master
self.master.config(bg='green')
self.initface = Frame(self.master,)
self.initface.pack()
btn = Button(self.initface,text='change-go next',command=self.go)
btn.pack()
def go(self):
self.initface.destroy()
#開(kāi)啟下一個(gè)界面
AppTest(self.master,)
class AppTest():
def __init__(self,master):
self.master = master
self.master.config(bg='red')
self.interface = Frame(self.master,)
self.interface.pack()
btn_back = Button(self.interface,text='back-',command=self.back)
btn_back.pack()
def back(self):
self.interface.destroy()
AppMain(self.master)
if __name__ == '__main__':
root = Tk()
BaseDesk(root)
root.mainloop()
效果: