Python tkinter布局与按钮间距设置

新建label与button,并设置位置(grid)

import tkinter as tk
root = tk.Tk()
label = tk.Label(root, text = ‘Label’)
label.grid(column = 3, row = 8)

button = tk.Button(root, text = ‘Button’)
button.grid(column = 5, row = 1)

按钮间距设置

col_count, row_count = root.grid_size()

for col in xrange(col_count):
root.grid_columnconfigure(col, minsize=20)

for row in xrange(row_count):
root.grid_rowconfigure(row, minsize=20)

你可能感兴趣的:(Python,tkinter,按钮间距)