如何在tkinter中显示markdown格式的文本? [英] How to show markdown format text in tkinter?

查看:107
本文介绍了如何在tkinter中显示markdown格式的文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在具有 tkinter GUI的 python-3.x 中,我开发了一个带有常规简单窗口的程序.

In python-3.x with tkinter GUI, I developed a program with a regular simple window.

我想显示保存在程序窗口中名为 markdownText 的字符串中的 markdown 格式字符串:

I want to show a markdown format string saved in a string called markdownText on program window:

markdownText='_italic_ or **bold**'

所需的输出是:

斜体粗体

有什么解决办法吗?

推荐答案

我只是在寻找类似的解决方案,确实似乎没有针对Python,TkInter和降价.但是,继续搜索显示了以下选项:

I was just searching for a similar solution, and it does indeed not seem like there is a default module/class/library for the combination of Python, TkInter and markdown. However a continued search revealed the following options:

  • Python-Markdown –该模块能够将markdown解析为以下输出格式: Python-Markdown可以输出HTML4,XHTML和HTML5的文档.
  • TkInter显示html –如链接的答案所示,
  • Python-Markdown – This a module capable of parsing markdown into the following output formats: Python-Markdown can output documents in HTML4, XHTML and HTML5.
  • TkInter displaying html – As the linked answer indicates, Tkhtml can display html "pretty well", and it has a python wrapper

换句话说,如果您愿意使用转换为html的中间步骤,这可能是在tkinter GUI中显示markdown字符串的可行途径.

In other words, if you are willing to use an intermediate step of converting into html that might be a viable route for you to display markdown strings within a tkinter GUI.

这篇关于如何在tkinter中显示markdown格式的文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆