Python 如何让sash_place()在启动时工作?
我有一个Tkinter PanedWindow,如果我使用sash_place(0,50,50)和一个函数,它就可以正常工作。如果,不管是谁,我想把它放在最初的位置,它什么也不做。启动时如何放置窗扇Python 如何让sash_place()在启动时工作?,python,tkinter,Python,Tkinter,我有一个Tkinter PanedWindow,如果我使用sash_place(0,50,50)和一个函数,它就可以正常工作。如果,不管是谁,我想把它放在最初的位置,它什么也不做。启动时如何放置窗扇 import Tkinter as tk def move(): allContent.sash_place(0,100,100) root = tk.Tk() root.geometry("1280x720+80+50") # the toolbar toolBar = tk.Fra
import Tkinter as tk
def move():
allContent.sash_place(0,100,100)
root = tk.Tk()
root.geometry("1280x720+80+50")
# the toolbar
toolBar = tk.Frame(root, bg="blue")
toolBar.pack(anchor="nw")
# buttons
button_2 = tk.Button(toolBar, text="move", command=move)
button_2.pack(side="left",)
# main window
allContent = tk.PanedWindow(root, background="red", orient="horizontal", relief="ridge", bd=5, sashrelief="raised")
contentLeft = tk.Frame(allContent)
allContent.add(contentLeft)
contentRight = tk.Frame(allContent)
allContent.add(contentRight)
allContent.pack(fill="both", expand=1)
statusBar = tk.Label(root, text="Status")
statusBar.pack(anchor="sw")
allContent.sash_place(0,100,100) # How do I get this to work here?
root.mainloop()
将
allContent.update()。这对我来说适用于3.4.2。我的想法来自,它说使用update_idletasks,它不起作用,只显示代码而不显示任何一个。太好了。成功了。如果我在包装前打电话给它,它似乎是一个非常干净的解决方案。耶!似乎我真的可以(: