From: Miroslav Lichvar Date: Fri, 11 Jul 2008 13:13:07 +0000 (+0200) Subject: add setHeight to Textbox class X-Git-Tag: r0-52-10~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7dc27ce1b9dafa9d5a8ee36f584db7184dd8e8e3;p=thirdparty%2Fnewt.git add setHeight to Textbox class --- diff --git a/snack.py b/snack.py index 7e7cdc0..7fa1d8b 100644 --- a/snack.py +++ b/snack.py @@ -212,11 +212,15 @@ class Textbox(Widget): - Textbox(self, width, height, scroll = 0, wrap = 0): scroll, wrap are flags include scroll bars, or text wrap. - setText(text) : set text. + - setHeight(height): set height. """ def setText(self, text): self.w.textboxText(text) + def setHeight(self, height): + self.w.textboxHeight(height) + def __init__(self, width, height, text, scroll = 0, wrap = 0): self.w = _snack.textbox(width, height, text, scroll, wrap) diff --git a/snackmodule.c b/snackmodule.c index 0f5628e..456add8 100644 --- a/snackmodule.c +++ b/snackmodule.c @@ -204,6 +204,7 @@ static PyObject * widgetListboxGetSel(snackWidget * s, PyObject * args); static PyObject * widgetListboxSet(snackWidget * s, PyObject * args); static PyObject * widgetListboxClear(snackWidget * s, PyObject * args); static PyObject * widgetTextboxText(snackWidget * s, PyObject * args); +static PyObject * widgetTextboxHeight(snackWidget * s, PyObject * args); static PyObject * widgetCheckboxTreeAddItem(snackWidget * s, PyObject * args); static PyObject * widgetCheckboxTreeGetSel(snackWidget * s, PyObject * args); static PyObject * widgetCheckboxTreeGetCur(snackWidget * s, PyObject * args); @@ -220,6 +221,7 @@ static PyMethodDef widgetMethods[] = { { "setCallback", (PyCFunction) widgetAddCallback, METH_VARARGS, NULL }, { "labelText", (PyCFunction) widgetLabelText, METH_VARARGS, NULL }, { "textboxText", (PyCFunction) widgetTextboxText, METH_VARARGS, NULL }, + { "textboxHeight", (PyCFunction) widgetTextboxHeight, METH_VARARGS, NULL }, { "entrySetValue", (PyCFunction) widgetEntrySetValue, METH_VARARGS, NULL }, { "listboxAddItem", (PyCFunction) widgetListboxAdd, METH_VARARGS, NULL }, { "listboxInsertItem", (PyCFunction) widgetListboxIns, METH_VARARGS, NULL }, @@ -653,6 +655,17 @@ static PyObject * widgetTextboxText(snackWidget * s, PyObject * args) { return Py_None; } +static PyObject * widgetTextboxHeight(snackWidget * s, PyObject * args) { + int height; + + if (!PyArg_ParseTuple(args, "i", &height)) return NULL; + + newtTextboxSetHeight(s->co, height); + + Py_INCREF(Py_None); + return Py_None; +} + static snackWidget * listboxWidget(PyObject * s, PyObject * args) { snackWidget * widget; int height;