Hi,
I had to reply just to say many thanks!
I was really stuck! I am a relatively newbie working with avogadro
and am still trying to get acquainted with its “guts”. But, you
realize that without dealing with this problem there wasn’t much
I could do.
Sure, now as I browse the documentation, I see references to this
glwidget object. But, before, I never paid much attention to it
(its name sounded like something quite internal to avogadro, it
didn’t sound anything like what I was looking for). It is always
easier to look after things once you have found them … 
Even that protein.py example in the page you pointed at
(http://avogadro.openmolecules.net/wiki/Python_Extensions)
it was just what I was looking for! Was it always there???
Sorry for wasting your time by not looking properly at the avogadro’s
website.
Anyway, if you allow me a suggestion: it would be useful for anyone
reading the docs about python scripting to have a reference to this
glwidget right at the beginning of introductory docs. Just a single
sentence would suffice calling attention to it and explaining its role.
I assume the glwidget is essential, as it is the entry point to
any objects that you have on the screen, right? So if you are
getting started with python scripting, that should be a place
where you get started at.
I think that the introductory text on python scripting is oriented
towards the Python Terminal. It refers to the Avogadro.molecule
and not to glwidget.molecule.
As you explained, we have the Avogadro.molecule variable as a
convenience in Python Terminal but not in the python standalone
scrits. In my experience, this can be a source of confusion as
one would expect (at least I did) a uniform behavior inside the
Python Terminal and inside python scripts. It doesn’t matter
so much if you refer to something named “Avogadro.molecule” or
“glwidget.molecule” but I would expect it to be present both in
the terminal and inside a script.
On Thu, 21 May 2009, Tim Vandermeersch wrote:
Yes, there have been some drastic changes but these where needed to
allow python scripts to be used as Tools, Engines (Display types) and
Extensions. Apart from some minor changes (user suggestions), the
python API will remain unchanged for 1.0.
I didn’t mean this as a criticism, I was just pointing out the fact.
I know that these changes, although they do require some extra work
in adapting the scripts, they are meant for a greater good ultimately!
Anyway, I reiterate my thanks for your help (and sorry for the length
of this message!) and extend it to the developers of Avogadro, which
is becoming a nice software. Maybe when I get more familiar with it
I can give my contribution too.
Cheers,
Alfredo