Apply gtk3 background. · matplotlib/matplotlib@2eff4d1 · GitHub
Skip to content

Commit 2eff4d1

Browse files
committed
Apply gtk3 background.
Currently, gtk3 widget backgrounds are not being applied (which only matters if the figure patch is partially transparent). The lines added by this PR are equivalent to the call to `painter.eraseRect(self.rect())` in the qt5agg backend (compare http://doc.qt.io/qt-5/qpainter.html#eraseRect and https://developer.gnome.org/gtk3/stable/GtkStyleContext.html#gtk-render-background). As an example, run import os; os.environ["MPLBACKEND"] = "gtk3cairo" from pylab import * from gi.repository import Gtk rcParams["figure.facecolor"] = (0, 0, 0, 0) css = Gtk.CssProvider() css.load_from_data(b"* {background-color: red;}") gcf().canvas.get_style_context().add_provider( css, Gtk.STYLE_PROVIDER_PRIORITY_USER) gca() show() Without this patch, the red background is not drawn.
1 parent 4753f6c commit 2eff4d1

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

lib/matplotlib/backends/backend_gtk3agg.py

Lines changed: 5 additions & 1 deletion

lib/matplotlib/backends/backend_gtk3cairo.py

Lines changed: 4 additions & 1 deletion

0 commit comments

Comments
 (0)