[pygtk] Building custom widgets, and GNOME stuff.

David Allen s2mdalle@titan.vcu.edu
Thu, 28 Sep 2000 22:24:34 -0400


I searched the back messages of the group, and didn't find anything on
this topic, so here it is...

If I have a need for a special widget to use through pygtk, is it best
to write it in python using what pygtk already provides, or is it best
to write it in C, and then wrap it for python?  

First to clarify a bit, the widget I'm looking for would probably be a
new one, (I think) not just a 'compound' widget combining preexisting
ones.  The problem I'm having is this.  I need something that looks like a
GtkCTree with columns, but that can hold arbitrary widgets within the
columns.  Perusing Havoc Pennington's book on GNOME, I see this under

(...) tree with expandable nodes instead of a simple list.  GtkTree is
a more flexible tree widget, (it can have arbitrary widgets in the
tree cells) but is less efficient (...)

What I'm going to need is something that looks like GtkCTree but that
acts like a GtkTree.  The columns inside of an entry's row would
contain things similar to option menus and so on.  

Looking at the APIs for both, (I've done a bit
of programming with GTK in C, but never with these widgets) it's kind
of puzzling why they would be so totally different from one another
when their function is very similar.  Sure, CTree needs things that
Tree doesn't provide and so on, but the APIs are pretty far apart IMHO.

The question is: will GtkTree be able to do the job, or should I write
a new widget?  If so, in python only, or in C and wrapped?  It's quite
possible that I'm just being a tool and that GtkTree will work fine
with some massaging.  I've checked out
http://laguna.fmedic.unam.mx/~daniel/pygtutorial/index.html (pygnome
documentation) and haven't found any python examples of programming
with GtkTrees.  Does anybody know of any?

A note about GNOME...I've been running helixcode GNOME for a month or
so, and recently due to no perceivable change in my system, (with the
possible exception of installing pygnome) everything related to gnome
hangs.   For example, in the python interpreter, if I enter:

[x@localhost /home/x/code/python/Pulp]$ python
Python 1.5.2 (#1, Sep 17 1999, 20:15:36)  [GCC egcs-2.91.66
19990314/Linux (egcs- on linux-i386
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> from gtk import *
>>> from gnome.ui import *

(Insert a wait of about 5 minutes here, then Control-C repeatedly)

Traceback (innermost last):
  File "<stdin>", line 1, in ?
  "/var/tmp/gnome-python-root/usr/lib/python1.5/site-packages/gnome/ui.py", line 6, in ?

This isn't *totally* python related, because C programs written with
GNOME hang as well, but it seems to be the introduction of pygnome
that did this.  

Any help on any of these issues would be greatly appreciated.

David Allen
Junk is the ultimate merchandise.
The junk merchant does not sell his product to the consumer. 
He sells the consumer to the product. 
He does not improve and simplify his merchandise. 
He degrades and simplifies the client.
           -- William S. Burroughs