# -*-coding:utf-8-*-
#设置Button文本在控件上的显示位置
'''
anchor:指定组件的位置,可用的值为:
n(north)
s(south)
w(west)
e(east)
和
ne(north east)
nw(north west)
se(south east)
sw(south west)
'''
from tkinter import *
root = Tk()
for a in ['n', 's', 'e', 'w', 'ne', 'nw', 'se', 'sw']:
Button(root, text = 'anchor', anchor = a, width = 30, height = 4).pack()
root.mainloop()