我已经在Python 2.7中编写了一些代码,它将从.ini文件中读取一个字符串,并使用sympy.preview
生成LaTeX格式的字符串的.png图像。这个想法是使用这个脚本在我输入的时候在后台生成图像。问题是即使我在后台运行脚本(使用pythonw.exe),两个空的命令行窗口也会弹出latex.exe
和dvipng.exe
并立即关闭。这很烦人,因为它会打断我的打字。我希望能够在不中断的情况下“即时”进行。使用SymPy预览时,可以防止Cmd对话框弹出吗?
有没有办法阻止这些窗口打开?
这里是我的最低工作例如:
from sympy import preview # for generating Latex images
import ConfigParser # for reading .ini files
# read the latex commands from the .ini file:
config = ConfigParser.RawConfigParser()
config.read('mathPredictor.ini')
one = config.get('Words', 'one')
prefix = '\\Huge $' # make the Latex equations bigger
suffix = '$'
eqone = prefix + one + suffix
# for generating Latex images:
preview(eqone, viewer='file', filename='one.png', euler=False)
的.ini文件
[Words]
one=\alpha
我运行Windows 8与Python 2.7.10 64位。这个问题交叉发布在tex.SE。
你可以利用http://stackoverflow.com/questions/1802127/how-to-run-a-powershell-script-而不-显示-A-窗口。 –