Python tkinter Programming Button_6 set the position of the text on the Button control

# -*-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()

 

Published 33 original articles · won praise 5 · views 10000 +

Guess you like

Origin blog.csdn.net/qiukapi/article/details/104042564