简体   繁体   English

tkinter 文本行间距

[英]tkinter text line spacing

Is there a way to fractionally increase the spacing of lines in a tkinter text widget?有没有办法稍微增加 tkinter 文本小部件中的行间距?

I'd like to space my text at, say, 1.2 * font size to enable the user to adjust for readability.我想将我的文本间隔为 1.2 * 字体大小,以使用户能够调整可读性。

The spacing1, spacing2 and spacing3 parameters appear to be platform dependent, not supported on Windows, and whole lines only.间距 1、间距 2 和间距 3 参数似乎与平台相关,Windows 不支持,仅整行。

You can configure spacing in pixels as follows:您可以按如下方式配置像素间距:

text.config(spacing1=10)    # Spacing above the first line in a block of text
text.config(spacing2=10)    # Spacing between the lines in a block of text
text.config(spacing3=10)    # Spacing after the last line in a block of text

Works for me on Python 3.6.5 on win10.在 win10 上的 Python 3.6.5 上为我工作。 Or do you have an example of non-working code?或者你有非工作代码的例子吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM