python Gridlayout布局

import tkinter as tk
from tkinter import ttk
win = tk.Tk()
win.title("LabelFrame练习")
buttons_frame = ttk.LabelFrame(win, text=' Labels in a Frame ')
buttons_frame.grid(column=0,row=0,padx=200,pady=100)
ttk.Label(buttons_frame, text="标签1").grid(column=0, row=0, sticky=tk.W)
ttk.Label(buttons_frame, text="标签2").grid(column=0, row=1, sticky=tk.W)
ttk.Label(buttons_frame, text="标签3").grid(column=0, row=2, sticky=tk.W)
ttk.Button(buttons_frame, text="按钮1").grid(column=1, row=0, sticky=tk.W)
ttk.Button(buttons_frame, text="按钮2").grid(column=1, row=1, sticky=tk.W)
ttk.Button(buttons_frame, text="按钮3").grid(column=1, row=2, sticky=tk.W)
for child in buttons_frame.winfo_children():
child.grid_configure(padx=20, pady=10)
win.mainloop()
上一篇:新概念二册 Lesson6 Percy Buttons


下一篇:QStyle Push Buttons 按钮样式设计 (九)