Commit 91850cc
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 a0994d3 commit 91850cc
2 files changed
Lines changed: 9 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
41 | 45 | | |
42 | 46 | | |
43 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
42 | 45 | | |
43 | 46 | | |
44 | 47 | | |
| |||
0 commit comments