Python 为什么我的代码在关闭tKinter/appJar GUI后崩溃?

Python 为什么我的代码在关闭tKinter/appJar GUI后崩溃?,python,python-3.x,tkinter,appjar,Python,Python 3.x,Tkinter,Appjar,第一个问题 我是Python新手,尝试使用appJar制作一个基于文本的游戏来解决UI问题——问题是,最近我退出GUI时,GUI会使代码崩溃。无论我关闭窗口还是使用退出按钮来停止GUI,我都会遇到这个错误,它会阻止我在关闭UI后运行任何代码 错误: self.tk.call(_flatten((self._w, cmd)) + self._options(cnf)) 这是我的密码: from appJar import gui import classes def startPr

第一个问题

我是Python新手,尝试使用appJar制作一个基于文本的游戏来解决UI问题——问题是,最近我退出GUI时,GUI会使代码崩溃。无论我关闭窗口还是使用退出按钮来停止GUI,我都会遇到这个错误,它会阻止我在关闭UI后运行任何代码

错误:


    self.tk.call(_flatten((self._w, cmd)) + self._options(cnf))
这是我的密码:

from appJar import gui 
import classes

def startProgram():
    # Main window and settings  
    with gui() as app:
        app.setTitle("CARAVAN")
        app.setSize("1000x700")
        app.setResizable(canResize=False)
        app.setGuiPadding(20, 20)
        app.setBg("dimgray", override=True)
        app.setFg("black", override=True)
        app.setFont(size=16, family="Source Code Pro")
        def exitProgram():
            app.stop()
        with app.labelFrame("Main Window", row=0, column=0, colspan=2, rowspan=2, stretch="both", sticky="nesw"):
            app.addButton("Exit", exitProgram, row=1, column=1)
        with app.labelFrame("Status", row=0, column=2, colspan=1, rowspan=1, stretch="row", sticky="nesw"):
            app.setStretch("both")
            app.setSticky("new")
            app.addLabel("Status1", row=0, column=0, colspan=1, rowspan=1)
            app.addLabel("Status2", row=1, column=0, colspan=1, rowspan=1)
        with app.labelFrame("Inventory", row=1, column=2, colspan=1, rowspan=1, stretch="row", sticky="nesw"):
            app.setStretch("both")
            app.setSticky("new")
            app.addLabel("Inv1", row=0, column=0, colspan=1, rowspan=1)
            app.addLabel("Inv2", row=1, column=0, colspan=1, rowspan=1)
        with app.labelFrame("Time", row=2, column=2, colspan=1, rowspan=1, stretch="row", sticky="esw"):
            app.addLabel("progress", "test")
        app.setSticky("esw")
        app.setStretch("column")
        app.addLabelEntry(" ", row=2, colspan=1)
        app.setEntryDefault(" ", "Respond here...")
    app.go()

startProgram()


无效的命令名“
告诉您根窗口已被破坏。“.”是根窗口的内部名称


您没有显示足够的代码来确定问题,但底线是在根窗口被破坏后,您正在执行一些tkinter代码。

您有一个缩进错误,这是:
app.go()
,必须位于
中,gui()作为app:
块。