您的代码没有问题。
问题在于您使用的是非单位长度的
non-monospace字体,其中字符占用的空间不相同。
可以通过更改为如下
monospace字体来解决
consolas
import tkFontmy_font = tkFont.Font(family='Consolas', size=15, weight='bold')# then plug in the font to your widget ...
所以在你的代码中,它就像
label_id = tkinter.Label(f, anchor=tkinter.W, text=sector_id, font=('Consolas', 15))label_name = tkinter.Label(f, anchor=tkinter.W, text=sector_name, font=('Consolas', 15))
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)