Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否有与 grid_remove() 方法等效的包,其中小部件的原始 pack() 设置在 re-pack() 上恢复?
用例:当我显示已通过 pack_forget() 隐藏的打包小部件时,我希望在发出 widget.pack() 显示请求时使用其原始包设置重新打包小部件。
不,没有等价物。只有pack_forget当你恢复它时,它不记得小部件在哪里。如果我需要这种功能,我只需使用网格几何管理器。
pack_forget
from tkinter import * root = Tk() b = Button(root, text="Delete me", command=lambda: b.grid_remove()) b.grid(row=0,column=0) root.mainloop() grid_remove works