【问题标题】:tkinter text line spacingtkinter 文本行间距
【发布时间】:2020-12-03 22:58:27
【问题描述】:

有没有办法在 tkinter 文本小部件中逐步增加行间距?

我想将文本间隔设置为 1.2 * 字体大小,以便用户调整可读性。

spacing1、spacing2 和 spacing3 参数似乎取决于平台,在 Windows 上不受支持,并且仅支持整行。

【问题讨论】:

  • spacing1spacing2spacing3 选项是影响行间距的唯一方法。

标签: python tkinter tk


【解决方案1】:

您可以按如下方式配置间距(以像素为单位):

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

在 win10 上的 Python 3.6.5 上为我工作。或者你有一个非工作代码的例子吗?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-23
    相关资源
    最近更新 更多