文本字段不会扩展到 textfield_frame = frame 的大小。为什么?后来我想将更多的小部件放入更多的框架中,这就是为什么我在这里从根框架内的一个框架开始。提前致谢。
import Tkinter
root = Tkinter.Tk()
ScreenSizeX = root.winfo_screenwidth()
ScreenSizeY = root.winfo_screenheight()
FrameSizeX = int(ScreenSizeX * 0.7)
FrameSizeY = int(ScreenSizeY * 0.7)
FramePosX = (ScreenSizeX - FrameSizeX)/2
FramePosY = (ScreenSizeY - FrameSizeY)/2
root.geometry("%dx%d%+d%+d"%(FrameSizeX,FrameSizeY,FramePosX,FramePosY))
frame = Tkinter.Frame(root)
frame.pack()
textfield_frame_height = FrameSizeY
textfield_frame = Tkinter.Frame(frame,width=FrameSizeX,height=ScreenSizeY,bg="yellow")
textfield_frame.pack()
text = Tkinter.Text(textfield_frame)
text.pack(fill="both", expand=1)
root.mainloop()