簡體   English   中英

用文本小部件編寫的行中的間距

[英]Spacing in the lines written in text widget

如果有人非常了解 tkinter,他會得到我真正要問的。

我有一個代碼,我試圖在其中查看該選項的影響,或者您可以說出名為spatial2的文本小部件的關鍵字。 我想知道為什么使用這個選項。

from tkinter import *
root = Tk()

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

root.mainloop()

幫助我了解為什么這里使用這個選項或名為spacing2 的關鍵字。

根據文檔(例如here

此選項指定當邏輯行換行時在顯示的文本行之間添加多少額外的垂直空間。 默認值為 0。

這是一個非常明顯的例子:

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()

截屏

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM