problem displaying sympy rendered svg in python

后端 未结 1 807
遥遥无期
遥遥无期 2020-12-19 15:24

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:

  1. The svg is not
相关标签:
1条回答
  • 2020-12-19 15:39

    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.

    0 讨论(0)
提交回复
热议问题