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

Skip to content

Commit dd22a69

Browse files
committed
Add a GTK4 backend.
1 parent c667ea1 commit dd22a69

File tree

11 files changed

+978
-17
lines changed

11 files changed

+978
-17
lines changed

lib/matplotlib/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,8 +1098,8 @@ def use(backend, *, force=True):
10981098
backend names, which are case-insensitive:
10991099
11001100
- interactive backends:
1101-
GTK3Agg, GTK3Cairo, MacOSX, nbAgg, QtAgg, QtCairo,
1102-
TkAgg, TkCairo, WebAgg, WX, WXAgg, WXCairo, Qt5Agg, Qt5Cairo
1101+
GTK3Agg, GTK3Cairo, GTK4Agg, GTK4Cairo, MacOSX, nbAgg, QtAgg,
1102+
QtCairo, TkAgg, TkCairo, WebAgg, WX, WXAgg, WXCairo, Qt5Agg, Qt5Cairo
11031103
11041104
- non-interactive backends:
11051105
agg, cairo, pdf, pgf, ps, svg, template

lib/matplotlib/backend_bases.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ def _safe_pyplot_import():
101101
backend_mapping = {
102102
'qt': 'qtagg',
103103
'gtk3': 'gtk3agg',
104+
'gtk4': 'gtk4agg',
104105
'wx': 'wxagg',
105106
'tk': 'tkagg',
106107
'macosx': 'macosx',
@@ -1656,7 +1657,7 @@ class FigureCanvasBase:
16561657
A high-level figure instance.
16571658
"""
16581659

1659-
# Set to one of {"qt", "gtk3", "wx", "tk", "macosx"} if an
1660+
# Set to one of {"qt", "gtk3", "gtk4", "wx", "tk", "macosx"} if an
16601661
# interactive framework is required, or None otherwise.
16611662
required_interactive_framework = None
16621663

@@ -1732,7 +1733,7 @@ def _fix_ipython_backend2gui(cls):
17321733
# don't break on our side.
17331734
return
17341735
rif = getattr(cls, "required_interactive_framework", None)
1735-
backend2gui_rif = {"qt": "qt", "gtk3": "gtk3",
1736+
backend2gui_rif = {"qt": "qt", "gtk3": "gtk3", "gtk4": "gtk4",
17361737
"wx": "wx", "macosx": "osx"}.get(rif)
17371738
if backend2gui_rif:
17381739
if _is_non_interactive_terminal_ipython(ip):

0 commit comments

Comments
 (0)