使用 Tkinter 的 Graphviz .dot 输出

Graphviz .dot output with Tkinter

我创建了一个 python 程序的一部分,该程序从用户那里获取输入并生成一个 .dot 文件来绘制与特定输入相对应的有限自动机图。该程序的 GUI 基于 Tkinter 库构建。

我想知道是否有办法将 .dot 文件转换为 PNG 文件或我可以在 Tkinter 中显示的东西 window,因为我知道的唯一方法需要显式命令命令:

dot output.dot -Tpng -o image.png

感谢您的宝贵时间

您可以 运行 从 Python 中使用 subprocess.run() 的任意命令。