I am using Grid manager to set each of my label frame in rows and columns, after my code run, the middle 2 frame does not appear as what i set in my coding.How can i ensure the middle 2 frame is appear in my program, Regards.
from tkinter import *
class ConfigureUAinterface(Frame):
def __init__(self, master):
root.minsize(width=700, height=520)
root.maxsize(width=700, height=520)
Frame.__init__(self, master)
Grid.config(self)
#FramePackA:Configuration UA
self.framepackA = LabelFrame(master,width=200,height=520,background='red')
self.framepackA.grid(row=0,column=0,rowspan=1)
self.framepackA.grid_propagate(0)
#FramePackB:DateSelection
self.framepackB = LabelFrame(master,width=260,height=198,background='grey')
self.framepackB.grid(row=1,column=1)
self.framepackB.grid_propagate(0)
#FramePackC:Final Step
self.framepackC = LabelFrame(master,width=260,height=322,background='light blue')
self.framepackC.grid(row=2,column=1)
self.framepackC.grid_propagate(0)
#FramePackD:Case Suggestion for UA
self.framepackD = LabelFrame(master,width=240,height=520,background='dark violet')
self.framepackD.grid(row=0,column=2)
self.framepackC.grid_propagate(0)
root = Tk()
root.title("UA Configuration")
cuai= ConfigureUAinterface(root)
root.mainloop()
In the first two lines of your init, you set your maxheight to 520.
Your first row elements (A, D) are at a height of 520.
The second row element (B) can not be displayed as it exceeds the frame limits.
The third row element (D) is not affected by self.framepackC.grid_propagate(0).
using grid_propagate(0) is not wrong, but grid_propagate(False) would be much more readable.
increasing max_size to height=1020 would make them visible.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.