简体   繁体   中英

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.

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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