8000 Implement macosx FigureManager.resize · matplotlib/matplotlib@aa02e4c · GitHub
[go: up one dir, main page]

Skip to content

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit aa02e4c

Browse files
committed
Implement macosx FigureManager.resize
This allows Figure.set_size_inches to work.
1 parent e62af58 commit aa02e4c

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/_macosx.m

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,22 @@ static CGFloat _get_device_scale(CGContextRef cr)
810810
}
811811
}
812812

813+
static PyObject*
814+
FigureManager_resize(FigureManager* self, PyObject *args, PyObject *kwds)
815+
{
816+
int width, height;
817+
if (!PyArg_ParseTuple(args, "ii", &width, &height)) {
818+
return NULL;
819+
}
820+
Window* window = self->window;
821+
if(window)
822+
{
823+
// 36 comes from hard-coded size of toolbar later in code
824+
[window setContentSize: NSMakeSize(width, height + 36.)];
825+
}
826+
Py_RETURN_NONE;
827+
}
828+
813829
static PyMethodDef FigureManager_methods[] = {
814830
{"show",
815831
(PyCFunction)FigureManager_show,
@@ -831,6 +847,11 @@ static CGFloat _get_device_scale(CGContextRef cr)
831847
METH_NOARGS,
832848
"Returns the title of the window associated with the figure manager."
833849
},
850+
{"resize",
851+
(PyCFunction)FigureManager_resize,
852+
METH_VARARGS,
853+
"Resize the window (in pixels)."
854+
},
834855
{NULL} /* Sentinel */
835856
};
836857

0 commit comments

Comments
 (0)
0