Frame Widgets and Centering : Pack « Tkinker « Python Tutorial






Frame Widgets and Centering
from Tkinter import *

root = Tk()
root.geometry("600x500+10+10")

myContainer = Frame(root)
myContainer.pack(side=TOP, expand=YES, fill=BOTH)

myLabel = Label(myContainer, text="This is a test")
myLabel.pack(side=TOP, expand=YES, fill=BOTH)


root.mainloop()








18.23.Pack
18.23.1.Pack control to the topPack control to the top
18.23.2.Pack a framePack a frame
18.23.3.pack(expand=YES, fill=BOTH)pack(expand=YES, fill=BOTH)
18.23.4.Set control's properties through dictionary syntaxSet control's properties through dictionary syntax
18.23.5.Frame Widgets and CenteringFrame Widgets and Centering
18.23.6.Pack control to Top, left and rightPack control to Top, left and right
18.23.7.Add equivalent pack windowAdd equivalent pack window
18.23.8.Add label and resizingAdd label and resizing