我目前有一个带有两个LabelPanes的窗口。在rightPane中,我有三个LabelFrames。当我调整窗口大小时,最底部的LabelFrame变大,但顶部的两个保持设置高度时指定的大小。我希望当窗口在Y轴上调整大小时,它们三个都均匀增长。这可能吗?
import tkinter as tk
if __name__ == '__main__':
appHeight=720
aspectRatio=16/9
appWidth=int(appHeight*aspectRatio)
app=tk.Tk()
app.title("Title")
app.minsize(width=appWidth,height=appHeight)
#================================================================================
# Setup Panes
#================================================================================
#Create Left Pane for settings
leftPane = tk.PanedWindow(bd=4,relief='raised',bg='red')
leftPane.pack(fill=tk.BOTH,expand=1)
#Add Settings Frame to Pane
settingsFrame = tk.LabelFrame(leftPane,text='Signature Filters',padx=5,pady=5,width=int(appWidth/4))
leftPane.add(settingsFrame)
#Create Right Pane for charts
rightPane = tk.PanedWindow(leftPane,orient=tk.VERTICAL,bd=4,relief=tk.SUNKEN,bg='blue')
leftPane.add(rightPane)
#Add Depth Frame to Pane
depthFrame = tk.LabelFrame(rightPane,text='Depth Signature',padx=5,pady=5,height=int(appHeight/3))
rightPane.add(depthFrame)
#Add Velocity Frame to Pane
velocityFrame = tk.LabelFrame(rightPane,text='Velocity Signature',padx=5,pady=5,height=int(appHeight/3))
rightPane.add(velocityFrame)
#Add Depth Frame to Pane
currentFrame = tk.LabelFrame(rightPane,text='Current Signature',padx=5,pady=5,height=int(appHeight/3))
rightPane.add(currentFrame)
app.mainloop()
答案 0 :(得分:3)
添加每个窗格时,您需要为字符串“始终”定义stretch
选项。
rightPane.add(depthFrame, stretch="always")
rightPane.add(velocityFrame, stretch="always")
rightPane.add(currentFrame, stretch="always")
stretch
接受以下值:
此信息来自标准tcl / tk文档的paneconfigure部分。
答案 1 :(得分:0)
您将需要设置框格位置。我编写了一些代码,以使右侧窗格的大小更改时,右侧的所有窗格相等。
#include <assert.h>
#include <limits.h>
#include <stdlib.h>
typedef struct {
int arrival_time;
int burst_time;
} Process;
typedef struct {
const Process *zero_index_reference;
int value;
size_t index;
} MinBurst;
int main()
{
size_t const nindex = -1;
Process processes[3] = {{10, 8}, {22, 3}, {43, 1}};
//...
MinBurst min_burst = {processes, INT_MAX, nindex};
int max_time = 42;
size_t const count = sizeof(processes)/sizeof(processes[0]);
for (size_t j = 0; j < count; j ++) {
Process *p = &processes[j];
if (p->arrival_time <= max_time && p->burst_time > 0)
if (p->burst_time < min_burst.value)
{
min_burst.value = p->burst_time;
min_burst.index = p - min_burst.zero_index_reference;
}
}
}