* Added function Blender.Draw.GetStringWidth().

* Added doc and small test for Blender.Test
* trying changes to make Blender.Test.unlink() safer.
This commit is contained in:
2003-06-26 02:03:51 +00:00
parent dd8f216691
commit 72f0cdace4
8 changed files with 408 additions and 174 deletions

View File

@@ -347,7 +347,7 @@ static PyObject *Method_Button (PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "siiiii|s", &name, &event,
&x, &y, &w, &h, &tip))
return EXPP_ReturnPyObjError (PyExc_TypeError,
"expected a string, five ints and optionally another string as arguments");
"expected a string, five ints and optionally another string as arguments");
block= Get_uiBlock();
@@ -621,6 +621,24 @@ static PyObject *Method_String (PyObject *self, PyObject *args)
return (PyObject *) but;
}
static PyObject *Method_GetStringWidth (PyObject *self, PyObject *args)
{
char *text;
PyObject *width;
if (!PyArg_ParseTuple (args, "s", &text))
return EXPP_ReturnPyObjError (PyExc_TypeError,
"expected string argument");
width = PyInt_FromLong(BMF_GetStringWidth (G.font, text));
if (!width)
return EXPP_ReturnPyObjError (PyExc_MemoryError,
"couldn't create PyInt");
return width;
}
static PyObject *Method_Text (PyObject *self, PyObject *args)
{
char *text;