I am just learning how to write simple GUI app in tkinter and I am stuck on a point when I want to close child1 as the first step of child2 function.
What I want to achieve is on the click of "next button" previous window is closed and new is appear. Here an example of my python3 code. Browsed information on TopLevel on the internet, but without any luck.
Sorry for stupid question, but got no one else to ask :(
from tkinter import *
class TestApp:
def __init__(self, master):
self.master = master
master.minsize(width=800, height=640)
self.button = Button(master, text='Next', command=self.firstWindow)
self.button.pack()
def firstWindow(self):
self.master.withdraw()
newWindow = Toplevel(self.master)
newWindow.minsize(width=800, height=640)
self.button = Button(newWindow, text='Next', command=self.secondWindow)
self.button.pack()
def secondWindow(self):
CODE TO CLOSE FIRST CHILD HERE
second_newWindow = Toplevel(REFERENCE TO FIRST CHILD HERE?)
second_newWindow.minsize(width=800, height=640)
self.button = Button(second_newWindow, text='Quit', command=self.master.quit())
self.button.pack()