Ron Dunn
Ron Dunn

Reputation: 3078

tkinter text line spacing

Is there a way to fractionally increase the spacing of lines in a tkinter text widget?

I'd like to space my text at, say, 1.2 * font size to enable the user to adjust for readability.

The spacing1, spacing2 and spacing3 parameters appear to be platform dependent, not supported on Windows, and whole lines only.

Upvotes: 3

Views: 6446

Answers (1)

figbeam
figbeam

Reputation: 7176

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. Or do you have an example of non-working code?

Upvotes: 6

Related Questions