|

楼主 |
发表于 2025-3-1 19:03:46
|
显示全部楼层
修改上述代码, 可以弹出对话框, 但是点击对话框中“确定”按钮的时候, 会报如下错误:
Traceback (most recent call last):
File "D:/program/python_code/tk_meassage.py", line 7, in <module>
mainloop()
File "D:\program\Python\Python312\Lib\tkinter\__init__.py", line 653, in mainloop
_get_default_root('run the main loop').tk.mainloop(n)
File "D:\program\Python\Python312\Lib\tkinter\__init__.py", line 323, in _get_default_root
raise RuntimeError(f"Too early to {what}: no default root window")
RuntimeError: Too early to run the main loop: no default root window |
|