如何使sash_place()在启动时工作? - python

我有一个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.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()

python大神给出的解决方案

allContent.update()放在allContent.sash_place之前。这对我来说适用于3.4.2。我从here那里得到了一个想法,该想法说它使用update_idletasks,它不起作用,并且仅显示代码而没有一个。