我正在开发用于M?ssbauer光谱学(化学)的仿真软件,但是在设计UI时,在用父级小部件调整子级小部件的尺寸时遇到了问题.当窗口最大化时,父框架将填充额外的空间,但子窗口小部件不会更改其大小.
from Tkinter import *
import ttk
import tkFileDialog as FileDialog
from PIL import Image, ImageTk
import tkFont
import matplotlib
from numpy import sin, pi
root = Tk()
# Main Container
content = ttk.Frame(root)
bold = tkFont.Font(family='Helvetica', weight='bold')
LeftFrame = ttk.Frame(content, borderwidth=5, relief="groove", width=200)
RightFrame = ttk.Frame(content, borderwidth=5, relief="groove", width=750)
text = Text(LeftFrame, height=40, width=30, padx=5, pady=5)
..... Some Codes .....
# Geometry
LeftFrame.grid(column=0, row=1, rowspan=2, sticky=(N, S, E, W))
RightFrame.grid(column=1, row=1, columnspan=3, rowspan=2, sticky=(N, S, E, W))
namelbl.grid(column=0, row=1, sticky=(N, S, E, W), padx=5)
text.grid(column=0, row=2, sticky=(N, S, E, W))
root.columnconfigure(0, weight=1)
root.rowconfigure(0, weight=1)
content.columnconfigure(0, weight=1)
content.columnconfigure(1, weight=3)
content.columnconfigure(2, weight=3)
content.columnconfigure(3, weight=3)
content.rowconfigure(1, weight=1)
root.state("zoomed")
root.mainloop()
因此,我的问题是如何以相同的速率使用LeftFrame(父级)更改文本小部件(子级)的大小.在我的情况下,只有LeftFrame扩展,而文本不变.