I'm running Python 3.5 under Windows 10, and I'm using matplotlib.pyplot
to generate PGF files, which are images I use for use in LaTeX.
I'm running a front-end GUI that gives the end-user configuration options, and then make calls into matplotlib.pyplot.savefig()
which generates and saves the image.
The problem I have is that the matplotlib
backend used (backend_pgf.py
) makes a subprocess.Popen()
call that forces a Windows console window (cmd) to pop up in order to do the required LaTeX processing. Visually it's distracting to the user and should be hidden.
Here's that code fragment:
latex = subprocess.Popen([str(self.texcommand), "-halt-on-error"],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
cwd=self.tmpdir)
What I want to do is prevent that console window from displaying. I know I can use subprocess.STARTUPINFO() to set dwFlags and prevent this console window from displaying (or pass in shell=True
).
I could override the class in question, but that class is nested deep in other classes and modules, so you can imagine the complexity of managing the code base for a simple function change.
My question then is... how to make this change in a logically deep package like matplotlib?
Thanks much.
Rich