所以我目前正在编写一段代码,稍后将集成到其他东西中以充当设置配置器。目前,我想要一个像下面这样布局的窗口:

其中每个彩色框都是一个框架。此窗口不可调整大小,并且始终为 480x720 像素。因此,我希望我使用的 3 个框架、sideBar(黄色)、容器(蓝色)和静态(红色)始终保持相同的大小并以大致相同的比例填充如上图所示的窗口(不需要是精确的)。
此窗口的代码如下
self.window = tk.Tk()
self.windowHeight = 480
self.windowLength = 720
self.windowDimensions = str(self.windowLength)+"x"+str(self.windowHeight) #make diemnsions string; dimensions are set as a single string
self.window.geometry(self.windowDimensions)
self.window.resizable(width=False, height=False)
self.container = tk.Frame(self.window, relief="sunken", borderwidth=2) #instantiate new window
self.sideBar = tk.Frame(self.window, relief="sunken", borderwidth=2)
self.static = tk.Frame(self.window, relief="sunken", borderwidth=2)
self.sideBar.grid_propagate(False)
self.sideBar.grid(row=0, column=0)
self.container.grid(row=0,column=1)
self.static.grid(row=5, column=1)
self.configuratorObject = configuratorObject
audioButton = tk.Button(self.sideBar, text="Audio Page", command=lambda: self.raisePage("audioPage"))
colourButton = tk.Button(self.sideBar, text="Colours", command=lambda: self.raisePage("coloursPage"))
saveButton = tk.Button(self.static, text = "Save", …Run Code Online (Sandbox Code Playgroud)