_tkinter.TclError:无法使用几何管理器网格。已经有包管理的奴隶

时间:2016-12-27 22:09:51

标签: python tkinter

我正在尝试创建一个GUI应用程序,但发现最简单的代码会给我一个错误。我似乎无法弄清楚我做错了什么。

这是导致错误的代码部分:

container = tk.Frame(self)
container.pack(side="top", fill="both", expand=True)
container.grid_rowconfigure(0, weight=1)
container.grid_columnconfigure(0, weight=1)

self.frames = {}

for F in (Teams, Final):
    frame = F(container)
    self.frames[F] = frame
    frame.grid(row=0, column=0, sticky="nsew")

self.show_frame(Teams)

这是追溯:

Traceback (most recent call last):  
File "D:/Files/Code/Python/SPI/Beta/GUI/SPIgui.py", line 47, in <module>
     app = SPI()  
File "D:/Files/Code/Python/SPI/Beta/GUI/SPIgui.py", line 36, in __init__  
    frame.grid(row=0, column=0, sticky="nsew")  
File "C:\Users\dsull\AppData\Local\Programs\Python\Python35\lib\tkinter\__init__.py", line 2074, in grid_configure + self._options(cnf, kw))  
_tkinter.TclError: cannot use geometry manager grid inside . which already has slaves managed by pack

您可以在此处找到我的计划的完整源代码:http://pastebin.com/SD7x0EnE

0 个答案:

没有答案