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

Skip to content

Commit e94cfbb

Browse files
Michiel de HoonMichiel de Hoon
Michiel de Hoon
authored and
Michiel de Hoon
committed
Adding a flush_events method to the MacOSX backend
1 parent 233ffdb commit e94cfbb

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/_macosx.m

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ static void _dealloc_atsui(void)
248248

249249
static int _draw_path(CGContextRef cr, void* iterator, int nmax)
250250
{
251-
double x1, y1, x2, y2, x3, y3;
251+
double x1, y1, x2, y2;
252252
static unsigned code = STOP;
253253
static double xs, ys;
254254
CGPoint current;
@@ -3424,6 +3424,20 @@ static void _data_provider_release(void* info, const void* data, size_t size)
34243424
return Py_None;
34253425
}
34263426

3427+
static PyObject*
3428+
FigureCanvas_flush_events(FigureCanvas* self)
3429+
{
3430+
View* view = self->view;
3431+
if(!view)
3432+
{
3433+
PyErr_SetString(PyExc_RuntimeError, "NSView* is NULL");
3434+
return NULL;
3435+
}
3436+
[view displayIfNeeded];
3437+
Py_INCREF(Py_None);
3438+
return Py_None;
3439+
}
3440+
34273441
static PyObject*
34283442
FigureCanvas_set_rubberband(FigureCanvas* self, PyObject *args)
34293443
{
@@ -3699,6 +3713,11 @@ static void _data_provider_release(void* info, const void* data, size_t size)
36993713
METH_NOARGS,
37003714
"Invalidates the canvas."
37013715
},
3716+
{"flush_events",
3717+
(PyCFunction)FigureCanvas_flush_events,
3718+
METH_NOARGS,
3719+
"Flush the GUI events for the figure."
3720+
},
37023721
{"set_rubberband",
37033722
(PyCFunction)FigureCanvas_set_rubberband,
37043723
METH_VARARGS,

0 commit comments

Comments
 (0)