Show More
@@ -0,0 +1,5 b'' | |||
|
1 | No popup in window for latex generation | |
|
2 | ======================================= | |
|
3 | ||
|
4 | When generating latex (e.g. via `_latex_repr_`) no popup window is shows under Windows. | |
|
5 |
@@ -144,6 +144,13 b" def latex_to_png_dvipng(s, wrap, color='Black', scale=1.0):" | |||
|
144 | 144 | find_cmd('dvipng') |
|
145 | 145 | except FindCmdError: |
|
146 | 146 | return None |
|
147 | ||
|
148 | startupinfo = None | |
|
149 | if os.name == "nt": | |
|
150 | # prevent popup-windows | |
|
151 | startupinfo = subprocess.STARTUPINFO() | |
|
152 | startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW | |
|
153 | ||
|
147 | 154 | try: |
|
148 | 155 | workdir = Path(tempfile.mkdtemp()) |
|
149 | 156 | tmpfile = "tmp.tex" |
@@ -156,7 +163,11 b" def latex_to_png_dvipng(s, wrap, color='Black', scale=1.0):" | |||
|
156 | 163 | with open(os.devnull, 'wb') as devnull: |
|
157 | 164 | subprocess.check_call( |
|
158 | 165 | ["latex", "-halt-on-error", "-interaction", "batchmode", tmpfile], |
|
159 |
cwd=workdir, |
|
|
166 | cwd=workdir, | |
|
167 | stdout=devnull, | |
|
168 | stderr=devnull, | |
|
169 | startupinfo=startupinfo, | |
|
170 | ) | |
|
160 | 171 | |
|
161 | 172 | resolution = round(150*scale) |
|
162 | 173 | subprocess.check_call( |
@@ -179,6 +190,7 b" def latex_to_png_dvipng(s, wrap, color='Black', scale=1.0):" | |||
|
179 | 190 | cwd=workdir, |
|
180 | 191 | stdout=devnull, |
|
181 | 192 | stderr=devnull, |
|
193 | startupinfo=startupinfo, | |
|
182 | 194 | ) |
|
183 | 195 | |
|
184 | 196 | with workdir.joinpath(outfile).open("rb") as f: |
General Comments 0
You need to be logged in to leave comments.
Login now