Python tkinter

from tkinter import *
#root = Tk()

# Label(root, text="Username").grid(row=0, sticky=W)
# Label(root, text="Passqord").grid(row=1, sticky=W)
# Entry(root).grid(row=0, column=1, sticky=E)
# Entry(root).grid(row=1, column=1, sticky=E)
# Button(root, text="Login").grid(row=2, column=1,sticky=E)
# root.mainloop()

# pack using in windows
# frame = Frame(root)
# Label(frame, text="PACK DEMO of side and fill").pack()
# Button(frame, text="A").pack(side=LEFT, fill=Y)
# Button(frame, text="B").pack(side=TOP, fill=X)
# Button(frame, text="C").pack(side=RIGHT, fill=NONE)
# Button(frame, text="D").pack(side=TOP, fill=BOTH)
# frame.pack()
# Label(root, text="Pack demo of expand").pack()
# Button(root, text="I do not expand").pack()
# Button(root, text="I not fill x both I expand").pack(expand=1)
# Button(root, text="I fill x and expand").pack(fill=X, expand=1)
# root.mainloop()

#Find&Replace Dialoge
parent = Tk()
parent.title("Find & Replace")

Label(parent,text="Find:").grid(row=0,column=0,sticky="e")
Entry(parent,width=60).grid(row=0,column=1,padx=2,pady=2,sticky='we',columnspan=9)

Label(parent,text="Replace:").grid(row=1,column=0,sticky="e")
Entry(parent).grid(row=1,column=1,padx=2,pady=2,sticky='we',columnspan=9)

Button(parent,text='Find').grid(row=0,column=10,sticky='e'+'w',padx=2,pady=2)
Button(parent,text='Find All').grid(row=1,column=10,sticky='e'+'w',padx=2)
Button(parent,text='Replace').grid(row=2,column=10,sticky='e'+'w',padx=2)
Button(parent,text='Replace All').grid(row=3,column=10,sticky='e'+'w',padx=2)

Checkbutton(parent,text='Macth all word only').grid(row=2,column=1,columnspan=4,sticky='w')
Checkbutton(parent,text='Match Case').grid(row=3,column=1,columnspan=4,sticky='w')
Checkbutton(parent,text='Wrap around').grid(row=4,column=1,columnspan=4,sticky='w')

Label(parent,text='Direction').grid(row=2,column=6,sticky='w')
Radiobutton(parent,text='UP',value=1).grid(row=3,column=6,columnspan=6,sticky='w')
Radiobutton(parent,text='Down',value=1).grid(row=3,column=7,columnspan=6,sticky='w')
parent.mainloop()

注意:编程环境使用了 parent.mainloop(),程序才开始运行。