Aqu*_*ing 1 python tk-toolkit tkinter
我想知道如何一次获取一个Text小部件中的所有标签.所以让我们说这是我的内容:
("keyword", print) ("string", "Hello world!")
("keyword", print) ("string", "You are"), ("support", raw_input())
self.text.tag_config('keyword', foreground="orange")
self.text.tag_config('operator', foreground="blue")
self.text.tag_config('number', foreground="red")
self.text.tag_config('string', foreground="red")
self.text.tag_config('support', foreground="blue")
self.text.tag_config('comment', foreground="violet")
self.text.tag_config('error', background="red")
self.text.tag_config('warning', background="yellow")
Run Code Online (Sandbox Code Playgroud)
现在,是否有任何函数/常量只能获取我的字符串中当前的标签?它会报告['keyword', 'string', 'support'].
(注意:大多数情况下我只是想知道这个因为我很好奇.如果不存在,那就不是世界末日.:P)
注意:第二个代码块是用Python编写的,我希望在Python中得到答案.:)
.tag_names(指数=无)
如果传递索引参数,则此方法返回与该索引之后的字符关联的所有标记名称的序列.如果不传递参数,则会获得文本小部件中定义的所有标记名称的序列.
.tag_ranges(tagName) 列出使用特定标记的索引.
| 归档时间: |
|
| 查看次数: |
2050 次 |
| 最近记录: |