Python Tkinter 控件通用属性 作者:马育民 • 2023-08-21 20:51 • 阅读:10051 # width 宽度,单位:一个字符的宽度 # height 高度,单位:一行的高度 # 设置背景色 ``` tk.Label(window, text='IP:', width=10,anchor='e',bg="red") ``` # anchor 文本对齐方式,有以下几个值: center:居中显示,默认值 n:顶部对齐 ne:右上对齐 e:靠右侧对齐 se:右下对齐 s:底部对齐 sw:左下对齐 w:靠左对齐 nw:左上对齐 原文出处:https://malaoshi.top/show_1IX65gB45qdp.html