'Graphviz .dot output with Tkinter

I have created part of a python program which takes input from user and generates a .dot file to draw a finite automata graph corresponding to certain inputs. The GUI of the program is built on the Tkinter library.

I would like to know if there is a way to convert the .dot file into a PNG file or something I can display in a Tkinter window, as the only way I know of requires explicit commands in CMD:

dot output.dot -Tpng -o image.png

Thank you for your time



Solution 1:[1]

You can run arbitrary commands from within Python with subprocess.run().

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 yut23