tkinter文本小部件带有自动标记?
tkinter中是否有文本小部件自动显示文本字符串的标记?因此,例如,如果我插入:** lorem ipsum ** dolor sit _amet _amet _
到此类文本窗口小部件,它将自动显示:
lorem ipsum ipsum dolor sit amet amet
,我已经尝试使用text.tag_add()方法来对文本的某些部分进行硬编码降标,但是它没有用,并且如果您可以自动这样做,则是不切实际的。因此,相反,我询问是否有一种文本小部件或文本小部件的函数/方法可以为您完成工作。
Is there a Text widget in Tkinter that automatically displays the markdown of a string of text? So for example, if I insert: **Lorem ipsum** dolor sit _amet_
to such Text widget, it automatically displays:
Lorem ipsum dolor sit amet
To achieve this, I already tried using the Text.tag_add() method to hard-code the markdown in certain parts of the text, but it didn't work somehow and it's impractical if you can do it automatically anyways. So instead I am asking if there is a type of Text widget or a function/method of the Text widget that does the work for you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
tk.text
中没有自动降低的特定方法或属性,但是可以将其作为绑定到函数的绑定。该代码说明了如何实现自动降级。
函数
Markdown
每次都调用键返回
被按下。There are no specific methods or attributes for automatic markdown in
tk.Text
, however it can be implemented as a binding to a function.This code demonstrates how automatic markdown might be achieved.
Function
markdown
is called every timeKey-Return
is pressed.