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

Skip to content

Commit f8ffce6

Browse files
authored
Merge pull request #25280 from QuLogic/new-gtk4-css
Fix setting CSS with latest GTK4
2 parents 506efe5 + ed324fc commit f8ffce6

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)