[pygtk] GTK bug? Or PyGTK bug? Or annoyance (better way to do it?)

John Ehresman jpe@archaeopteryx.com
Tue, 14 Nov 2000 11:52:09 -0500 (EST)


> From: LF <lf11@andonet.com>
> 
> I'm trying to make a GtkText box, give it some text, and have it as a
> static display in a window.  I don't like "Gtk-CRITICAL" warnings that
> don't seem to matter, but I *REALLY* don't like "Gtk-CRITICAL" and Xlib
> errors that lock things up.  Ewww!
> 
> Pardon the *really* dumb variable names.
> -----
> a_message_box = GtkText()
> a_message_box.insert_text("this is a test")
> a_message_box.set_editable(FALSE)
> a_main_vbox.add(a_message_box)
> a_message_box.show()

Part of the problem with this series of calls is that the
_wrap_gtk_editable_insert_text function passes an uninitialized position
variable to the editable.  This bug affects both the GtkEntry & GtkText
widgets. One way to fix this is to add an optional argument to
insert_text, which defaults to 0, so the wrapper function looks like this
(and then modify gtk.py to call the wrapper with an extra argument):

static PyObject *_wrap_gtk_editable_insert_text(PyObject *self, PyObject
*args) {
    PyGtk_Object *o;
    char *text;
    int len;
    int pos = 0;
    if (!PyArg_ParseTuple(args, "O!s#|i:gtk_editable_insert_text",
			  &PyGtk_Type, &o, &text, &len, &pos))
        return NULL;
    gtk_editable_insert_text(GTK_EDITABLE(PyGtk_Get(o)), text, len, &pos);
    return PyInt_FromLong(pos);
}

Is there any possibility of another release of the gtk-1.2 compatible 
pygtk series?  From my casual reading of the gtk lists, it does not look
like the gtk 2.0 release is imminent.

Thanks,

John