我有一个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()
将
allContent.update()
放在allContent.sash_place
之前。这对我3.4.2来说很有用。我是从here得到这个想法的,它说使用update_idletask,但它不起作用,它只显示没有这两种方法的代码。在相关问题 更多 >
编程相关推荐