Python Tkinter Text Formatting Markers

不羁的心 提交于 2019-12-13 02:35:57

问题


In programs and IDEs, I've seen options to show different markers. It tends to be spaces, but Word shines more light on this with more markers to show.

I was wondering if showing markers like this were possible in Tkinter with the Text widget.

I have a link from the Word help file to explain a little more what I'm looking for. https://support.content.office.net/en-us/media/f5cc9771-1070-4ebf-bd7a-4d3dc245966f.png

I was thinking that I could do this with tags and a for loop, but I was wondering if the Text widget took handle of that and worked it out itself. I've read through the Effbot and TutorialsPoint pages for the Text widget and they both don't mention anything about this, the Effbot page does mention something about markers, but I don't know what to do. But then again, there are other things that they do not mention about other or the same widget.


回答1:


There is nothing built-in to support this. You'll have to loop over the content yourself, adding tags and possibly inserting images or unicode characters into the text.

The "marks" in a tkinter text widget are like bookmarks -- named locations within the text. They are completely unrelated to the types of markers mentioned in the word documentation you linked to.



来源:https://stackoverflow.com/questions/37055505/python-tkinter-text-formatting-markers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!