8000 FIX: Add a 0-length timer to allow fast animations to redraw on macosx · matplotlib/matplotlib@017ad0d · GitHub
[go: up one dir, main page]

Skip to content

Commit 017ad0d

Browse files
committed
FIX: Add a 0-length timer to allow fast animations to redraw on macosx
The macosx backend would not update on flush_events calls due to the loop being run too fast for the view to update properly in the NSApp. Fix that by adding an unnoticeable RunLoop timer slowdown that allows the app to see the changes.
1 parent 546393d commit 017ad0d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/_macosx.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,9 @@ static CGFloat _get_device_scale(CGContextRef cr)
385385
static PyObject*
386386
FigureCanvas_flush_events(FigureCanvas* self)
387387
{
388+
// We need to allow the runloop to run very briefly
389+
// to allow the view to be displayed when used in a fast updating animation
390+
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.0]];
388391
[self->view displayIfNeeded];
389392
Py_RETURN_NONE;
390393
}

0 commit comments

Comments
 (0)
0