我有这个代码,应该可以使用,但出于某种原因,actionFrame和infoFrame会相互放在一起......
from tkinter import *
root = Tk()
root.title("TNT Manager")
root.configure(background='grey')
root.grid_rowconfigure(0,weight=1)
root.grid_columnconfigure(0,weight=1)
plannerFrame = Frame(root, bg='grey')
plannerFrame.grid(row=0, column=0, sticky='NSEW')
plannerFrame.grid_rowconfigure(0, weight=15)
plannerFrame.grid_rowconfigure(1, weight=1)
plannerFrame.grid_columnconfigure(0, weight=5)
plannerFrame.grid_columnconfigure(1, weight=2)
actionFrame = Frame(plannerFrame, width=500, height=400)
actionFrame.grid_propagate(0)
actionFrame.grid(row=0, column=0, sticky="NSEW", padx=1,pady=1)
infoFrameWid(actionFrame) #for now just adds text widget inside frame
infoFrame = Frame(plannerFrame, width=200, height=400)
infoFrame.grid_propagate(0)
infoFrame.grid(row=0, column=1, sticky="NSEW", padx=1, pady=1)
infoFrameWid(infoFrame)
saveFrame = Frame(plannerFrame)
infoFrame.grid(row=1, column=0, padx=1, pady=1)
我遇到的问题是infoFrame小部件位于actionframe小部件之上。他们在同一排。如果你拿走了saveframe小部件就可以了。
答案 0 :(得分:0)
你必须改变atlast
saveFrame = Frame(plannerFrame)
infoFrame.grid(row=1, column=0, padx=1, pady=1)
到
saveFrame = Frame(plannerFrame,width=700, height=400)
saveFrame.grid(row=1, column=0, padx=1, pady=1)