Hello, I submitted my first patch recently for the curses color_set and wcolor_set functions. I am now working on addchstr, addchnstr, mvaddchstr, mvaddchnstr, mvwaddchstr, mvwaddchnstr, waddchstr and waddchnstr.
I have implemented the non window specific methods as follows: /* Window.addchstr Inserted Steve Owens 2/25/2005 */ static PyObject * PyCursesWindow_AddChstr(PyCursesWindowObject *self, PyObject *args) { int x, y, n; PyStringObject *pS; switch (PyTuple_Size(args)) { case 1: if (!PyArg_ParseTuple(args, "S;(String) expected for waddchstr", &pS)) return NULL; return PyCursesCheckERR(waddchstr(self->win, (chtype*)PyString_AsString(pS)), "waddchstr"); case 2: if (!PyArg_ParseTuple(args, "Si;(String, int) expected for waddchnstr", &pS, &n)) return NULL; return PyCursesCheckERR(waddchnstr(self->win, (chtype*)PyString_AsString(pS), n), "waddchnstr"); case 3: if (!PyArg_ParseTuple(args,"iiS;(int, int, String) expected for mvwaddchstr", &y, &x, &pS)) return NULL; return PyCursesCheckERR(mvwaddchstr(self->win, y, x, (chtype*)PyString_AsString(pS)), "mvwaddchstr"); case 4: if (!PyArg_ParseTuple(args,"iiSi;(int, int, String, int) expected for mvwaddchnstr", &y, &x, &pS, &n)) return NULL; return PyCursesCheckERR(mvwaddchnstr(self->win, y, x, (chtype*)PyString_AsString(pS), n), "mvwaddchnstr"); default: PyErr_SetString(PyExc_TypeError, "addchstr requires 1 to 4 arguments"); } return NULL; } Now the thing is that when I make calls from python like so: curses.addchstr(5,10, "@ < Row 5, Col 10") curses.addchstr(8,10, "Below you should see ABCDEFG") curses.addchstr(9,10, "ABCDEFG") curses.addchstr(12,10, "Below you should see ABCD") curses.addchnstr(13,10, "ABCDEFGHI", 4) What prints out on the screen is gobledygook not the strings you would expect below. Any thoughts on how to correctly convert the PyStringObject arguments to chtype* pointers so that the ncurses library will be able to understand them? -- View this message in context: http://www.nabble.com/New-curses-module-method-addchstr%2C-etc.-tp22211983p22211983.html Sent from the Python - python-dev mailing list archive at Nabble.com. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com