Skip to content

Commit 8fae9a8

Browse files
committed
Force Agg backend before patchworklib import to fix Windows CI tkinter error
1 parent 2fec539 commit 8fae9a8

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

src/tpixel/renderer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ def to_patchwork(panel: Panel, label: str = "tpixel") -> "pw.Brick":
113113
Returns:
114114
A ``patchworklib.Brick`` ready for composition.
115115
"""
116+
matplotlib.use("Agg")
116117
import patchworklib as pw
117118

118119
w, h = panel_figsize(panel)

tests/test_patchwork.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22

33
from __future__ import annotations
44

5-
import matplotlib.pyplot as plt
6-
import patchworklib as pw
5+
import matplotlib
6+
matplotlib.use("Agg")
7+
8+
import matplotlib.pyplot as plt # noqa: E402
9+
import patchworklib as pw # noqa: E402
710

811
from tpixel.models import Marker, Panel, Region, SeqGroup
912
from tpixel.renderer import panel_figsize, plot_panel, to_patchwork

0 commit comments

Comments
 (0)