11# SPDX-License-Identifier: CC0-1.0
22
33import sys
4- import tempfile
4+ from tempfile import NamedTemporaryFile
55
66from matplotlib import interactive , is_interactive
77from matplotlib ._pylab_helpers import Gcf
88from matplotlib .backend_bases import FigureManagerBase , _Backend
99from matplotlib .backends .backend_agg import FigureCanvasAgg
10- from sixel import converter
10+ from sixel . converter import SixelConverter
1111
1212# XXX heuristic for interactive repl
1313if sys .flags .interactive :
1616
1717class FigureManagerSixel (FigureManagerBase ):
1818 def show (self ):
19- with tempfile . NamedTemporaryFile () as temppng :
19+ with NamedTemporaryFile () as temppng :
2020 self .canvas .figure .savefig (temppng .name , bbox_inches = "tight" , format = "png" )
21- sixel_convert = converter . SixelConverter (temppng )
21+ sixel_convert = SixelConverter (temppng )
2222 sixel_convert .write (sys .stdout )
2323
2424
@@ -35,9 +35,10 @@ class _BackendSixelAgg(_Backend):
3535 def mainloop ():
3636 return
3737
38- # XXX: `draw_if_interactive` isn't really intended for on-shot rendering. We run the risk of being called
39- # on a figure that isn't completely rendered yet, so we skip draw calls for figures that we detect as
40- # not being fully initialized yet. Our heuristic for that is the presence of axes on the figure.
38+ # XXX: `draw_if_interactive` isn't really intended for on-shot rendering.
39+ # We run the risk of being called on a figure that isn't completely rendered yet,
40+ # so we skip draw calls for figures that we detect as not being fully initialized yet.
41+ # Our heuristic for that is the presence of axes on the figure.
4142 @classmethod
4243 def draw_if_interactive (cls ):
4344 manager = Gcf .get_active ()
0 commit comments