我正在尝试调整大型机上的子帧布局。作为一个初学者,据我了解,我试图进行梳理,但未给出预期的结果。
代码:
from tkinter import *
root = Tk()
root.geometry("1390x700+0+0")
root.title("Top Frame")
root.configure(background = "white")
# layout all of the main containers
root.grid_rowconfigure(1, weight=1)
root.grid_columnconfigure(0, weight=1)
#################################################################################
#Frames
#################################################################################
Header_F = Frame(root, bd = 10, pady = 5)
Header_F.grid(row =0, column =0, sticky = W+E)
Components_F = Frame(root, bd = 10, width =500, height = 400)
Components_F.grid(row= 1, column = 0, sticky = NW, pady = 10)
Components_F.grid_propagate(False)
Communication_F = Frame(root, width = 100, height = 100)
Communication_F.grid(column = 1 , row = 1 , sticky = W )
Communication_F.grid_propagate(False)
实际结果: This is the image of actually result
预期结果:
答案 0 :(得分:0)
尝试一下:
from tkinter import *
root = Tk()
root.geometry("1390x700+0+0")
root.title("Top Frame")
root.configure(background = "white")
# layout all of the main containers
#root.grid_rowconfigure(1, weight=1)
#root.grid_columnconfigure(0, weight=1)
#################################################################################
#Frames
#################################################################################
Header_F = Frame(root, bd = 10, height = 40)
Header_F.grid(row =0, column =0, sticky = W+E)
Components_F = Frame(root, bd = 10, width =500, height = 400)
Components_F.grid(row= 1, column = 0, sticky = NW, pady = 10,padx = 10)
Components_F.grid_propagate(False)
Communication_F = Frame(root, width = 100, height = 100)
Communication_F.grid(column = 1 , row = 1, sticky = NW, pady = 10 )
Communication_F.grid_propagate(False)
root.mainloop()