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

Skip to content

Commit 652a4c3

Browse files
authored
Merge pull request #10506 from matplotlib/auto-backport-of-pr-10486
Backport PR #10486 on branch v2.2.x
2 parents 1b272b8 + 6d11782 commit 652a4c3

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

lib/matplotlib/backends/tkagg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def blit(photoimage, aggimage, bbox=None, colormode=1):
1919
else:
2020
bboxptr = 0
2121
data = np.asarray(aggimage)
22-
dataptr = (data.ctypes.data, data.shape[0], data.shape[1])
22+
dataptr = (data.shape[0], data.shape[1], data.ctypes.data)
2323
try:
2424
tk.call(
2525
"PyAggImagePhoto", photoimage,

lib/matplotlib/tests/test_backends_interactive.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ def _get_testable_interactive_backends():
4141
from matplotlib import pyplot as plt
4242
4343
fig = plt.figure()
44+
ax = fig.add_subplot(111)
45+
ax.plot([1,2,3], [1,3,1])
4446
fig.canvas.mpl_connect("draw_event", lambda event: sys.exit())
4547
plt.show()
4648
"""

src/_tkagg.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
#include "_tkmini.h"
2020

2121
#if defined(_MSC_VER)
22-
# define IMG_FORMAT "%Iu %d %d"
22+
# define IMG_FORMAT "%d %d %Iu"
2323
#else
24-
# define IMG_FORMAT "%zu %d %d"
24+
# define IMG_FORMAT "%d %d %zu"
2525
#endif
2626
#define BBOX_FORMAT "%f %f %f %f"
2727

@@ -73,10 +73,10 @@ static int PyAggImagePhoto(ClientData clientdata, Tcl_Interp *interp, int
7373
TCL_APPEND_RESULT(interp, "destination photo must exist", (char *)NULL);
7474
return TCL_ERROR;
7575
}
76-
/* get buffer from str which is "ptr height width" */
77-
if (sscanf(argv[2], IMG_FORMAT, &pdata, &hdata, &wdata) != 3) {
76+
/* get buffer from str which is "height width ptr" */
77+
if (sscanf(argv[2], IMG_FORMAT, &hdata, &wdata, &pdata) != 3) {
7878
TCL_APPEND_RESULT(interp,
79-
"error reading data, expected ptr height width",
79+
"error reading data, expected height width ptr",
8080
(char *)NULL);
8181
return TCL_ERROR;
8282
}

0 commit comments

Comments
 (0)