diff --git a/lib/matplotlib/backends/backend_gtk3agg.py b/lib/matplotlib/backends/backend_gtk3agg.py index f54849cf049c..47430c3709d7 100644 --- a/lib/matplotlib/backends/backend_gtk3agg.py +++ b/lib/matplotlib/backends/backend_gtk3agg.py @@ -4,7 +4,7 @@ from . import backend_agg, backend_cairo, backend_gtk3 from ._gtk3_compat import gi from .backend_cairo import cairo -from .backend_gtk3 import _BackendGTK3 +from .backend_gtk3 import Gtk, _BackendGTK3 from matplotlib import transforms # The following combinations are allowed: @@ -38,6 +38,10 @@ def on_draw_event(self, widget, ctx): if not len(self._bbox_queue): self._render_figure(w, h) + Gtk.render_background( + self.get_style_context(), ctx, + allocation.x, allocation.y, + allocation.width, allocation.height) bbox_queue = [transforms.Bbox([[0, 0], [w, h]])] else: bbox_queue = self._bbox_queue diff --git a/lib/matplotlib/backends/backend_gtk3cairo.py b/lib/matplotlib/backends/backend_gtk3cairo.py index fee4ff96c282..dcbf02eb5024 100644 --- a/lib/matplotlib/backends/backend_gtk3cairo.py +++ b/lib/matplotlib/backends/backend_gtk3cairo.py @@ -1,7 +1,7 @@ from . import backend_cairo, backend_gtk3 from ._gtk3_compat import gi from .backend_cairo import cairo -from .backend_gtk3 import _BackendGTK3 +from .backend_gtk3 import Gtk, _BackendGTK3 from matplotlib.backend_bases import cursors @@ -39,6 +39,9 @@ def on_draw_event(self, widget, ctx): # toolbar.set_cursor(cursors.WAIT) self._renderer.set_context(ctx) allocation = self.get_allocation() + Gtk.render_background( + self.get_style_context(), ctx, + allocation.x, allocation.y, allocation.width, allocation.height) self._render_figure(allocation.width, allocation.height) # if toolbar: # toolbar.set_cursor(toolbar._lastCursor)