Tkinter 报错_tkinter.TclError: can't add .!frame2 as slave of .!toplevel.!notebook
这是我的程序的一部分,我想实现一个子窗口(所以不能用tkinter.Tk())
之所以用mainloop(1)是因为不想让父窗口卡死
new = tkinter.Toplevel()
img = StyleDesign.styles_icons["stylesset"]
new.wm_iconphoto(False, img)
new.geometry("600x600")
new.title("MyTitle")
new.resizable(False, False)
def all_():
fr = tkinter.Frame()
fr.place({
"width": 600,
"height": 550,
})
return fr
frames = {
"form1": all_(),
}
ch = Notebook(new)
ch.add(frames["form1"], text="ONE")
ch.place({
"x": 0,
"y": 0,
"width": 600,
"height": 600,
})
new.mainloop(1)
出错部分是ch.add()行,报错内容:
_tkinter.TclError: can't add .!frame2 as slave of .!toplevel.!notebook