Skip to content

Commit 6afab09

Browse files
committed
merged mdboom's changes
2 parents 323cbf3 + 2800367 commit 6afab09

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

lib/matplotlib/backends/backend_cairo.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,10 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False):
200200
if angle:
201201
ctx.rotate (-angle * np.pi / 180)
202202
ctx.set_font_size (size)
203-
ctx.show_text (s.encode("utf-8"))
203+
if sys.version_info[0] < 3:
204+
ctx.show_text (s.encode("utf-8"))
205+
else:
206+
ctx.show_text (s)
204207
ctx.restore()
205208

206209
def _draw_mathtext(self, gc, x, y, s, prop, angle):

lib/matplotlib/backends/backend_gtk3agg.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
import cairo
22
import numpy as np
3+
import sys
4+
import warnings
35

46
import backend_agg
57
import backend_gtk3
68
from matplotlib.figure import Figure
79
from matplotlib import transforms
810

11+
if sys.version_info[0] >= 3:
12+
warnings.warn("The Gtk3Agg backend is not known to work on Python 3.x.")
13+
914

1015
class FigureCanvasGTK3Agg(backend_gtk3.FigureCanvasGTK3,
1116
backend_agg.FigureCanvasAgg):

src/_backend_agg.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,12 @@ BufferRegion::to_string_argb(const Py::Tuple &args)
178178
}
179179
}
180180

181-
return Py::String(str, true);
181+
#if PY3K
182+
return Py::Bytes
183+
#else
184+
return Py::String
185+
#endif
186+
(str, true);
182187
}
183188

184189

0 commit comments

Comments
 (0)