Can't get gtk.ListStore working under Python.



Greetings.


  Newbie here to programming Gnome/GTK.  I am using Python and Glade 2
  to create an interface, and I successfully hooked a few widgets.  But
  I have a problem with GTK::TreeView.  Following is my code:

    model = gtk.ListStore(gobject.TYPE_STRING)
    model.set(model.append(), 0, "Test1")


    # TVDepends is a GTK::TreeView widget (Thus, the TV prefix).
    depends=xml.get_widget("TVDependants")
    depends.set_model(model)


    renderer = gtk.CellRendererText()
    column = gtk.TreeViewColumn("Hosts", renderer, text=1)
    num = depends.append_column(column)


  When running my program, I get the following errors:


(autopoweroff:4650): Gtk-CRITICAL **: file gtkliststore.c: line 565 (gtk_list_store_get_value): assertion `column < GTK_LIST_STORE (tree_model)->n_columns' failed


(autopoweroff:4650): GLib-GObject-CRITICAL **: file gobject.c: line 1019 (g_object_set_property): assertion `G_IS_VALUE (value)' failed


(autopoweroff:4650): GLib-GObject-CRITICAL **: file gvalue.c: line 147 (g_value_unset): assertion `G_IS_VALUE (value)' failed


(autopoweroff:4650): Gtk-CRITICAL **: file gtkliststore.c: line 565 (gtk_list_store_get_value): assertion `column < GTK_LIST_STORE (tree_model)->n_columns' failed


(autopoweroff:4650): GLib-GObject-CRITICAL **: file gobject.c: line 1019 (g_object_set_property): assertion `G_IS_VALUE (value)' failed


(autopoweroff:4650): GLib-GObject-CRITICAL **: file gvalue.c: line 147 (g_value_unset): assertion `G_IS_VALUE (value)' failed


(autopoweroff:4650): Gtk-CRITICAL **: file gtkliststore.c: line 565 (gtk_list_store_get_value): assertion `column < GTK_LIST_STORE (tree_model)->n_columns' failed


(autopoweroff:4650): GLib-GObject-CRITICAL **: file gobject.c: line 1019 (g_object_set_property): assertion `G_IS_VALUE (value)' failed


  I do not find the problem.  I believe I am following the instructions
  provided by:


http://www.gnome.org/~james/pygtk-docs/class-gtkliststore.html
http://developer.gnome.org/doc/API/2.0/gtk/GtkListStore.html


  and the example found at:

    http://www.mail-archive.com/pygtk daa com au/msg05840.html


  If anybody has the answer, please share.  This is a blocker and my
  project is put on ice until it is resolved.




Sincerely,
Hans Deragon

--
Deragon Informatique inc.         Open source:
http://www.deragon.biz            http://swtmvcwrapper.sourceforge.net
mailto://hans deragon biz         http://autopoweroff.sourceforge.net




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]