Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
728 views
in Technique[技术] by (71.8m points)

python-3.x - 如何不开窗(How to not open window)

from tkinter import *

def firstPage():
    def goSecond():
        root.destroy()
        secondPage()

    root = Tk()

    text = Label(root, text="1")
    text.pack()
    btn = Button(root, text="go to 2", command=goSecond)
    btn.pack()

    root.mainloop()

def secondPage():
    def goFirst():
        root.destroy()
        firstPage()

    root = Tk()

    text = Label(root, text="2")
    text.pack()

    btn = Button(root, text="go to 1", command=goFirst)
    btn.pack()

    root.mainloop()

firstPage()

I made this code and I want it to open a new page, but it open a new window, I understand why but I don't know how to open a page instead of open a window.

(我编写了此代码,并希望它打开一个新页面,但是它打开了一个新窗口,我知道为什么,但是我不知道如何打开页面而不是打开窗口。)

  ask by Gionata Roberti translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...