Commit 3c98ea6a authored by Félix Hartmann's avatar Félix Hartmann
Browse files

Set backend to PyQt5.

parent c6c9e378
......@@ -4,10 +4,8 @@
from __future__ import (unicode_literals, absolute_import, division,
from traits.etsconfig.api import ETSConfig
ETSConfig.toolkit = 'qt'
import matplotlib as mpl
from controlpanel import ControlPanel
......@@ -7,17 +7,20 @@ pointed out to me by Pierre Haessig, March 2014
April 2019: a few changes for accomodating PyQt5, based on
from pyface.qt import QtGui
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from PyQt5.QtWidgets import QWidget, QVBoxLayout
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT
from matplotlib.figure import Figure
# from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT
from traits.api import Instance
from traitsui.qt4.editor import Editor
from traitsui.qt4.basic_editor_factory import BasicEditorFactory
# 'qt4' is for compatibility, and will be probably replaced with 'qt' in the future
class _MPLFigureEditor(Editor):
......@@ -32,15 +35,13 @@ class _MPLFigureEditor(Editor):
def _create_canvas(self, parent):
""" Create the MPL canvas. """
# matplotlib commands to create a canvas
frame = QtGui.QWidget()
"""Create the MPL canvas."""
frame = QWidget()
mpl_canvas = FigureCanvas(self.value)
# mpl_toolbar = NavigationToolbar2QTAgg(mpl_canvas,frame)
mpl_toolbar = NavigationToolbar2QT(mpl_canvas, frame)
vbox = QtGui.QVBoxLayout()
vbox = QVBoxLayout()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment