有没有办法在python的tkinter中更改'.mainloop()'?

时间:2019-01-20 19:16:43

标签: python tkinter

我当时正在做一个带有一些“指令”的小项目,在指令的结尾,我询问用户在程序运行时是否需要一个带有指令的窗口。如果答案是肯定的,则将运行tkinter代码,并且由于“ .mainloop()”,我无法返回菜单。我只有在关闭窗户后才能回来。

Exception Value: Got AttributeError when attempting to get a value for field `id` on serializer `JobsSerializer`.
The serializer field might be named incorrectly and not match any attribute or key on the `str` instance.
Original exception text was: 'str' object has no attribute 'id'.

还有其他方法可以使它运行时,窗口将打开并保持打开状态,并执行'menu()'吗?

1 个答案:

答案 0 :(得分:0)

您可以使用Toplevel创建另一个包含说明的窗口。用户可以单击按钮打开窗口并关闭它,而不会影响主窗口。请查看Jagandeep Singh的示例:Toplevel example

相关问题