плохой дисплей - PullRequest
       71

плохой дисплей

0 голосов
/ 16 февраля 2020
import sys
from PyQt5.QtWidgets import *
from matplotlib.figure import Figure
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas

from matplotlib import rc
rc("text", usetex=True)

app = QApplication(sys.argv)
fen = QDialog()

figure = Figure()
canvas = FigureCanvas(figure)
text_edit = QTextEdit()
list_widget = QListWidget()

layout = QHBoxLayout()
layout.addWidget(canvas)
layout.addWidget(text_edit)
fen.setLayout(layout)


def change():
    text = figure.suptitle(
        r'{}'.format(text_edit.toPlainText()),
        x=0.0,
        y=1.0,
        horizontalalignment='left',
        verticalalignment='top'
        )
    canvas.draw()

text_edit.textChanged.connect(change)


fen.show()
app.exec_()

У меня есть эта ошибка:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/matplotlib/texmanager.py", line 486, in make_png
    stderr=subprocess.STDOUT)
  File "/usr/lib/python3.6/subprocess.py", line 356, in check_output
    **kwargs).stdout
  File "/usr/lib/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['dvipng', '-bg', 'Transparent', '-D', '100.0', '-T', 'tight', '-o', 'b31418787d5e331336f86388cc930ab9.png', 'c073de3d59bf9cbb888f5b9c550ef4f8.dvi']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/loic/Application_math/test.py", line 31, in change
    canvas.draw()
  File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_qt5agg.py", line 127, in draw
    super(FigureCanvasQTAggBase, self).draw()
  File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_agg.py", line 430, in draw
    self.figure.draw(self.renderer)
  File "/usr/lib/python3/dist-packages/matplotlib/artist.py", line 55, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/matplotlib/figure.py", line 1299, in draw
    renderer, self, artists, self.suppressComposite)
  File "/usr/lib/python3/dist-packages/matplotlib/image.py", line 138, in _draw_list_compositing_images
    a.draw(renderer)
  File "/usr/lib/python3/dist-packages/matplotlib/artist.py", line 55, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/matplotlib/text.py", line 762, in draw
    mtext=mtext)
  File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_agg.py", line 250, in draw_tex
    Z = texmanager.get_grey(s, size, self.dpi)
  File "/usr/lib/python3/dist-packages/matplotlib/texmanager.py", line 545, in get_grey
    pngfile = self.make_png(tex, fontsize, dpi)
  File "/usr/lib/python3/dist-packages/matplotlib/texmanager.py", line 493, in make_png
    exc.output.decode("utf-8"))))
RuntimeError: dvipng was not able to process the following string:
b''

Here is the full report generated by dvipng:
c073de3d59bf9cbb888f5b9c550ef4f8.dvi: No such file or directory
This is dvipng 1.16 Copyright 2002-2015, 2019 Jan-Ake Larsson
rc("text", usetex=True) 

Эта строка вызывает ошибку, но я не вижу, как ее исправить. Я пытался установить / удалить MiKTeX 10 раз, но ничего не изменилось. У меня все еще есть ошибка.

Та же проблема здесь RuntimeError: LaTeX не смог обработать следующую строку: r'lb ' Но нет решения для меня

Я нашел то, что не подходит. Это просто пустые строки. Есть способ пропустить пустые строки? если я не могу передать это не очень полезно ^^

...