Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 51f6ef8

Browse files
authored
Merge pull request #10298 from anntzer/gtk3-background
FIX: Apply gtk3 background.
2 parents 766f03a + 91850cc commit 51f6ef8

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

lib/matplotlib/backends/backend_gtk3agg.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from . import backend_agg, backend_cairo, backend_gtk3
77
from ._gtk3_compat import gi
88
from .backend_cairo import cairo
9-
from .backend_gtk3 import _BackendGTK3
9+
from .backend_gtk3 import Gtk, _BackendGTK3
1010
from matplotlib import transforms
1111

1212
# The following combinations are allowed:
@@ -40,6 +40,10 @@ def on_draw_event(self, widget, ctx):
4040

4141
if not len(self._bbox_queue):
4242
self._render_figure(w, h)
43+
Gtk.render_background(
44+
self.get_style_context(), ctx,
45+
allocation.x, allocation.y,
46+
allocation.width, allocation.height)
4347
bbox_queue = [transforms.Bbox([[0, 0], [w, h]])]
4448
else:
4549
bbox_queue = self._bbox_queue

lib/matplotlib/backends/backend_gtk3cairo.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from . import backend_cairo, backend_gtk3
22
from ._gtk3_compat import gi
33
from .backend_cairo import cairo
4-
from .backend_gtk3 import _BackendGTK3
4+
from .backend_gtk3 import Gtk, _BackendGTK3
55
from matplotlib.backend_bases import cursors
66

77

@@ -39,6 +39,9 @@ def on_draw_event(self, widget, ctx):
3939
# toolbar.set_cursor(cursors.WAIT)
4040
self._renderer.set_context(ctx)
4141
allocation = self.get_allocation()
42+
Gtk.render_background(
43+
self.get_style_context(), ctx,
44+
allocation.x, allocation.y, allocation.width, allocation.height)
4245
self._render_figure(allocation.width, allocation.height)
4346
# if toolbar:
4447
# toolbar.set_cursor(toolbar._lastCursor)

0 commit comments

Comments
 (0)