我使用的是 RTL 语言,并且我需要我的文本为 RTL。有办法做到吗?我怎样才能证明我的文字合理?例子:
from tkinter import *
from tkinter.constants import *
root = Tk()
text = Text(root,,font=('Tahoma',8))#I need RTL and Right justified text!
text.grid()
scrl = Scrollbar(root, command=text.yview)
text.config(yscrollcommand=scrl.set)
scrl.grid(row=0, column=1, sticky='ns')
root.mainloop()
我修改了你的代码,它成功了!...
from tkinter import *
from tkinter.constants import *
root = Tk()
text = Text(root,,font=('Tahoma',8))#I need RTL and Right justified text!
text.tag_configure('tag-right', justify='right')
text.insert('end', 'text ' * 10, 'tag-right')
text.grid()
scrl = Scrollbar(root, command=text.yview)
text.config(yscrollcommand=scrl.set)
scrl.grid(row=0, column=1, sticky='ns')
root.mainloop()
事实上我添加了两行代码来设置justify=CENTER
for a Text
小部件失败:小部件没有这样的选项。
您想要的是使用参数创建一个标签justify
。然后您可以使用该标签插入一些文本(或者您可以插入任何文本,然后将标签应用到特定区域)...祝您好运! :)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)