我有一个问题,我需要在新窗口中单击按钮从 tkterminal 库中打包终端并销毁它(如切换),但是终端正在打包到已经存在的“根”窗口中,所以有一个代码:
def open_terminal():
global debounce
if debounce == True:
global cmd
cmd = tk.Toplevel(root)
cmd.title("Terminal")
global terminal
terminal = Terminal(pady=5, padx=5)
terminal.basename = "dolphinwriter$"
terminal.shell = True
terminal.pack(cmd, side="top", fill="both", expand=True)
debounce = False
print(debounce)
else:
cmd.destroy()
debounce = True
我正在尝试这个: