mirror of
https://github.com/Athemis/PyDSF.git
synced 2025-04-04 22:36:02 +00:00
25 lines
No EOL
907 B
Python
25 lines
No EOL
907 B
Python
from PyQt5 import QtWidgets
|
|
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
|
|
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QTAgg as NavigationToolbar
|
|
from matplotlib.figure import Figure
|
|
|
|
class MplCanvas(FigureCanvas):
|
|
def __init__(self):
|
|
self.fig = Figure()
|
|
self.ax = self.fig.add_subplot(111)
|
|
FigureCanvas.__init__(self, self.fig)
|
|
FigureCanvas.setSizePolicy(self, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
|
|
FigureCanvas.updateGeometry(self)
|
|
|
|
def clear(self):
|
|
self.ax.clear()
|
|
self.fig.clear()
|
|
|
|
class MplWidget(QtWidgets.QWidget):
|
|
def __init__(self, parent = None):
|
|
QtWidgets.QWidget.__init__(self, parent)
|
|
|
|
self.canvas = MplCanvas()
|
|
self.vbl = QtWidgets.QVBoxLayout()
|
|
self.vbl.addWidget(self.canvas)
|
|
self.setLayout(self.vbl) |