I am Python Novice , You have to write a simple GUI program , For the sake of simplicity , I choose to be in tkinter This is what we should do in the future .

What I want GUI It should be very similar to Windows Dialog boxes often encountered when installing programs on ( Where do you want to install , Modules you want, etc ). Basically when it's in the python3.3 Run time in , I want a window to appear , Some of these options occupy most of the window , And then there's the ',' return ' and ' cancel ' Button at the bottom ; click “ next step ”' Button , The current window is closed , Open a new window that looks the same , Except it has different options ( Or it could be the same window , But its content has been destroyed , I'm not sure which is better )
. The rough layout I want is shown in this image

in

I've been looking around for code , The code is similar to this , But no code was found . I saw it this answer, But it's not what I want . I use this
tutorial To find out what I'm interested in tkinter Understanding of , But I can't find the answer in it .

It's a terrible attempt at a simplified version of what I want to do : When I run the code , It creates a window with two buttons . '
Quit' The button is working properly ; however , When I click “ next step ” Button to close the window and open a new window as needed , But it also opens another window .

from tkinter import *

from tkinter import ttk

def win1():

mainframe = ttk.Frame(root, padding = '3 3 12 12')

mainframe.grid(column = 0, row = 0, sticky = (N, W, E, S))

mainframe.columnconfigure(0, weight = 1)

mainframe.rowconfigure(0, weight = 1)

ttk.Button(mainframe, text = 'Next', command = win2).grid(

column = 1, row = 1, sticky = W)

ttk.Button(mainframe, text = 'Quit', command = quit).grid(

column = 1, row = 2, sticky = W)

root.mainloop()

def quit():

root.destroy()

def win2():

quit()

new = Toplevel()

new.title('Window 2')

new = ttk.Frame(root, padding = '3 3 12 12')

new.grid(column = 0, row = 0, sticky = (N, W, E, S))

new.columnconfigure(0, weight = 1)

new.rowconfigure(0, weight = 1)

ttk.Button(mainframe, text = 'Next', command = win2).grid(

column = 1, row = 1, sticky = W)

root = Tk()

win1()

The following error message appears ( I don't understand ):

Exception in Tkinter callback

Traceback (most recent call last):

File "/usr/lib/python3.3/tkinter/__init__.py", line 1478, in __call__

return self.func(*args)

File "", line 23, in win2

File "/usr/lib/python3.3/tkinter/ttk.py", line 733, in __init__

Widget.__init__(self, master, "ttk::frame", kw)

File "/usr/lib/python3.3/tkinter/ttk.py", line 553, in __init__

tkinter.Widget.__init__(self, master, widgetname, kw=kw)

File "/usr/lib/python3.3/tkinter/__init__.py", line 2078, in __init__

(widgetName, self._w) + extra + self._options(cnf))

_tkinter.TclError: this isn't a Tk applicationNULL main window

Except for the fact that it didn't actually do what I wanted , I feel like I'm doing it in a completely wrong way ( Define windows, etc. in a function ), And there will be a lot of problems when I want to make it more complicated . Can anyone rewrite my code in a better way , And in some way helped me build more complex programs , Provide resources to learn the programs I need , I want to even offer advice ? thank .

Technology
Daily Recommendation