我有这段代码:
from tkinter import *
Import random
Import time
Root=Tk ()
Root. geometry ("1600x800+0+0")
Root. title ("Resaurant Management System")
Tops = Frame(root, width=1600 ,bg="powder blue",relief=SUNKEN)
Tops.pack(side=TOP)
f1 = Frame(root, width=800,height=700 ,bg="powder blue",relief=SUNKEN)
f1.pack(side=LEFT)
f2 = Frame(root, width=300,height=700 ,bg="powder blue",relief=SUNKEN)
f2.pack(side=RIGHT)
root.mainloop()
我收到了这个错误:
Traceback (most recent call last):
File "C:/Users/ersur/Downloads/restorent_mang_sy.py", line 11, in <module>
Tops.pack(side=TOP)
File "C:\Users\ersur\AppData\Local\Programs\Python\Python36-32\lib\tkinter\__init__.py", line 2738, in __init__
Widget.__init__(self, master, 'frame', cnf, {}, extra)
File "C:\Users\ersur\AppData\Local\Programs\Python\Python36-32\lib\tkinter\__init__.py", line 2293, in __init__
(widgetName, self._w) + extra + self._options(cnf))
_tkinter.TclError: can't invoke "frame" command: application has been destroyed
答案 0 :(得分:0)
首都&#34;我&#34; in&#34;导入&#34;创建语法错误。用&#34; import&#34;更改它。
在Tops中,f1和f2,改变&#34; root&#34;与&#34; Root&#34;因为,&#34; root&#34;未定义