Abhishek
Abhishek

Reputation: 54

Spacing in the lines written in text widget

If someone knows tkinter very well he will get what I am exactly asking.

I have a code where I am trying to see the impact of the option or you can say keyword of text widget named spacing2. I want to know why this option is used.

from tkinter import *
root = Tk()

txt = Text(root,spacing2 = 100)
txt.pack()

root.mainloop()

Help me to know why this option or keyword named spacing2 is used here.

Upvotes: 0

Views: 672

Answers (1)

j_4321
j_4321

Reputation: 16169

According to the documentation (e.g. here)

This option specifies how much extra vertical space to add between displayed lines of text when a logical line wraps. Default is 0.

Here is an example that makes it quite obvious:

from tkinter import Tk, Text
root = Tk()

txt = Text(root, spacing2=10, wrap='word', width=10)
txt.insert('1.0', 'This is a very long line that is wrapped.')
txt.pack()
txt2 = Text(root, wrap='word', width=10)
txt2.insert('1.0', 'This is a very long line that is wrapped.')
txt2.pack()

root.mainloop()

screenshot

Upvotes: 2

Related Questions