Python Tkinter Canvas产生损坏的后记文件

Seb*_*lzl 5 python canvas tkinter postscript

我有一个Tkinter画布,上面有服务器矩形,文本和线对象。

我用

.postscript(file='file.ps') 
Run Code Online (Sandbox Code Playgroud)

画布的方法。

当我尝试在Windows和Linux上使用ghostscript打开文件时,出现以下错误:

error: undefinedresult in stringwidth
Run Code Online (Sandbox Code Playgroud)

您对此有什么解决方案?

谢谢!

编辑:我正在使用python2

Seb*_*lzl 5

问题是.postscript-Methods仅接受某些字体。当我将Canvas文本对象的字体更改为arial时,它起作用了。虽然输出字体不是Arial,但是Courier。我将尝试查找Windows和Linux上默认都可用的一些字体。