8000 make blank occur in same event as blit · matplotlib/matplotlib@b63950e · GitHub
[go: up one dir, main page]

Skip to content

Commit b63950e

Browse files
make blank occur in same event as blit
drawing from a thread produces an intolerable flicker unless blank and blit are called from the same event in the main thread
1 parent 7196d37 commit b63950e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

lib/matplotlib/backends/_backend_tk.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ def _blit(argsid):
5353
"""
5454
Thin wrapper to pass arguments to blit via tkapp.call
5555
"""
56-
args = _blit_args.pop(argsid)
56+
photoimage, dataptr, offsets, bboxptr, blank = _blit_args.pop(argsid)
57+
args = (
58+
photoimage.tk.interpaddr(), str(photoimage), dataptr, offsets, bboxptr)
59+
if blank:
60+
photoimage.blank()
5761
_tkagg.blit(*args)
5862

5963

@@ -78,12 +82,12 @@ def blit(photoimage, aggimage, offsets, bbox=None):
7882
y1 = max(math.floor(y1), 0)
7983
y2 = min(math.ceil(y2), height)
8084
bboxptr = (x1, x2, y1, y2)
85+
blank = False
8186
else:
82-
photoimage.blank()
8387
bboxptr = (0, width, 0, height)
88+
blank = True
8489

85-
args = (
86-
photoimage.tk.interpaddr(), str(photoimage), dataptr, offsets, bboxptr)
90+
args = photoimage, dataptr, offsets, bboxptr, blank
8791
argsid = repr(id(args))
8892
_blit_args[argsid] = args
8993

0 commit comments

Comments
 (0)
0