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

Skip to content

Commit cf4a57a

Browse files
authored
Merge pull request #25285 from meeseeksmachine/auto-backport-of-pr-25280-on-v3.7.x
Backport PR #25280 on branch v3.7.x (Fix setting CSS with latest GTK4)
2 parents f4eac94 + 6ce12e7 commit cf4a57a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/matplotlib/backends/backend_gtk4.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ def __init__(self, figure=None):
7474
self.set_focusable(True)
7575

7676
css = Gtk.CssProvider()
77-
css.load_from_data(b".matplotlib-canvas { background-color: white; }")
77+
style = '.matplotlib-canvas { background-color: white; }'
78+
if Gtk.check_version(4, 9, 3) is None:
79+
css.load_from_data(style, -1)
80+
else:
81+
css.load_from_data(style.encode('utf-8'))
7882
style_ctx = self.get_style_context()
7983
style_ctx.add_provider(css, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
8084
style_ctx.add_class("matplotlib-canvas")

0 commit comments

Comments
 (0)