python - Tkinter 中的网格边框和边距为大

标签 python tkinter grid border margin

我想减小照片中线条(3 和 4)之间的距离。但 ipady 和 pady 都是 0,距离仍然很大(我希望它更小)。

代码:

labeljdisk = Label(root, text="3\tLaufwerk J\t\t" + filesd['jdisk']['status'], 
                   fg=filesd['jdisk']['color'],background=bg)
labeljdisk.config(font=("Monaco", 13))
labeljdisk.grid(row=1, column=0, padx='5', pady='0', ipady='0', sticky='W')

labelstandby = Label(root, text="4\tStandbymodus\t\t" + filesd['standby']['status'], 
                     fg=filesd['standby']['color'], background=bg)
labelstandby.config(font=("Monaco", 13))
labelstandby.grid(row=2, column=0, padx='5', pady='0', ipady='0', sticky='W')

照片:

enter image description here

最佳答案

您可以通过将 highlightthicknessborderwidth 设置为零来节省更多像素:

labeljdisk = Label(..., bd=0, highlightthickness=0)

关于python - Tkinter 中的网格边框和边距为大,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58970527/

相关文章:

javascript - 如何防止剑道网格中的页面更改

css - 如何为 EXTJS 6.2 现代网格行着色

javascript - 四面二维形状的分割

python - 用户站 pip 包目录

python - AWS ec2 实例上出现 "sudo pip"时出错

python - 了解 Tkinter Canvas 的性能限制

python - 如何在 Tkinter 中获取屏幕尺寸?

python - Visual Studio 代码和 virtualenv

python - 在 IPython/Jupyter Notebooks 中显示行号

python - 构建 tkinter 应用程序的最佳方式?