8000 FIX: add check if the renderer exists by tacaswell · Pull Request #5060 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

FIX: add check if the renderer exists #5060

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 14, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
FIX: add check if the renderer exists
There exists a path where paintEvent can be called before the first time
that `draw` has been called.  This results in an exception because the
call to `FigureCanvasAgg.draw(self)` is what create the renderer
attribute on the canvas.
  • Loading branch information
tacaswell committed Sep 13, 2015
commit 16baab901ce0a45459bbc954e3a0dba79d89c919
6 changes: 5 additions & 1 deletion lib/matplotlib/backends/backend_qt5agg.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,11 @@ def paintEvent(self, e):
In Qt, all drawing should be done inside of here when a widget is
shown onscreen.
"""
# FigureCanvasQT.paintEvent(self, e)
# if the canvas does not have a renderer, then give up and wait for
# FigureCanvasAgg.draw(self) to be called
if not hasattr(self, 'renderer'):
return

if DEBUG:
print('FigureCanvasQtAgg.paintEvent: ', self,
self.get_width_height())
Expand Down
0