I have the following program which uses sympy and svgmath to render a user\'s algebraic expression. It nearly works but there are a few issues:
You should close the file handles, because otherwise the data written may not yet have been flushed to the filesystem.
parser.parse()
output.close()
Alternatively, use a with
expression.
with open("test.svg", "w") as output:
...
parser.parse()
load()
Does an actual svg file need to be produced?
I think QSvgWidget
offers a load
slot, which takes a byte string with the file contents.