我已經在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-窗口。 –