http://blog.csdn.net/xxb2008
#-*-coding:utf-8-*-"" "tkconstants.py--Constant class Tkinter Layout pack parameter Description fill--X horizontal Fill (default, components from top to bottom), y vertical padding (each component from left to right), both filled Expand-1 when the size of the parent frame changes, automatically expands the size, 0 is false side--the left right top bottom dock on which side of the parent component anchor--alignment grid parameter description row--line number Rowspa N--merge row column--column number ColumnSpan--merge column sticky--component close to a corner of the cell (auto scale)--expand property of the same pack root.columnconfigure (0, W eight=1) root.rowconfigure (0, Weight=1) frame.grid (row=0, column=0, sticky= "Nsew") below is a program that blends pack padding (automatic scaling) and Grid padding (auto scale) and multi-component integration Layout http://blog.csdn.net/xxb2008 "" "" "" "" Import Tkinter class MainFrame (tkinter.frame): Def __init__
(Self, Master=none): tkinter.frame.__init__ (self, Master) Self.grid (row=0, column=0, sticky= "Nsew") Self.createframe () def createframe (self): Self.frametop = Tkinter.frame (self) self.frameTop.pack (fi Ll= "x") self.labelfilepaths = Tkinter.label (self.frametop, text= "file path:", width=10) SELF.LABELFILEPATHS.PA CK (fill= "y", Expand=0, Side=tkinter.lefT) self.textfilepaths = Tkinter.text (Self.frametop, height=10) Self.textFilePaths.pack (fill= "both", Expan D=1, side=tkinter.left) Self.framecenter = Tkinter.frame (self) self.frameCenter.pack (fill= "x") s Elf.framebottom = Tkinter.frame (self) self.frameBottom.pack (fill= "x") #self. Labelfilepaths = tkinter.la Bel (Self, text= "file path:", width=10) #self. Labelfilepaths.grid (row=0, Column=0, sticky= "W") #self. Textfilepa ths = Tkinter.text (Self.frame, height=10) #self. Textfilepaths.pack (fill= "both") #self. Textfilepaths.grid (r Ow=1, column=0, sticky= "Nsew") def main (): root = tkinter.tk () root.columnconfigure (0, Weight=1) root.rowcon Figure (0, Weight=1) root.geometry (' 640x360 ') #设置了主窗口的初始大小960x540 app = MainFrame (root) App.mainloop () If _ _name__ = = "__main__": Main ()