Commit cae28cb
committed
Update background in SpanSelector._press whenever useblit=True.
Previously, the canvas would only get redrawn when useblit=True only if
span_stays is set. This causes e.g.
import sys
from PyQt5.QtWidgets import *
from matplotlib.backends.backend_qt5agg import *
from matplotlib.figure import Figure
from matplotlib.widgets import SpanSelector
class App(QMainWindow):
def __init__(self):
super().__init__()
self.setCentralWidget(QWidget())
layout = QVBoxLayout()
self.centralWidget().setLayout(layout)
self._fig = Figure()
self._fig.subplots()
layout.addWidget(FigureCanvas(self._fig))
layout.addWidget(QPushButton("span", clicked=self._span_cb))
def _span_cb(self):
self._span = SpanSelector(
self._fig.axes[0], print, "horizontal", useblit=True)
qapp = QApplication(sys.argv)
app = App()
app.show()
qapp.exec_()
to use an incorrect background(?) when clicking and starting a span for
the first time.
To be honest I'm not sure this is exactly the correct solution, although
it does fix the issue...1 parent c465993 commit cae28cb
1 file changed
+2
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1811 | 1811 | | |
1812 | 1812 | | |
1813 | 1813 | | |
1814 | | - | |
1815 | | - | |
1816 | | - | |
1817 | | - | |
| 1814 | + | |
| 1815 | + | |
1818 | 1816 | | |
1819 | 1817 | | |
1820 | 1818 | | |
| |||
0 commit comments