[Glade-users] adding custom widgets

Tristan Van Berkom tristan.van.berkom at gmail.com
Tue Apr 21 16:20:33 EDT 2009


On Tue, Apr 21, 2009 at 3:37 PM, Gerald Britton
<gerald.britton at gmail.com> wrote:
> OK -- I found I needed an additional package (libgladeui-1-dev)
>
> Now I'm trying to set up a catalog.  The difficulty for me at this
> point is that I want to use it with Python.  Following the docs, and
> another tutorial I found,
>
> http://unpythonic.blogspot.com/2007/03/custom-pygtk-widgets-in-glade3.html
>
> I built a catalog, adding language="python" to the glade-catalog
> element.  But, I can't see how the Python code for the module would
> work, knowing what I do about Python imports.
>
> I'd sure love to see an end-to-end example.  Starting with vanilla
> glade-3, add a catalog and custom widgets, build a glade file using
> glade-3 using the custom widgets then see what the gtk+ application
> code looks like -- all with Python as the implementation language.

Juan, can you please show Gerald a working python example ?

We tried to get some example catalogs into the docs this
past autumn but it didnt make it in... For python, you should
be able to write your python widget in say, mybutton.py, then
you create a Glade catalog like normal, but you say library="python",
and name="mybutton", then any types introduced by the file mybutton.py
will be available, you need to reference them by making <glade-widget-class>
statements and grouping them in the palette with <glade-widget-group>.

Juan, please correct me if I'm wrong on this....

And then... when running python with GtkBuilder, your types must simply be
available before parsing the builder file (I believe thats just a
matter of importing
them first).

Cheers,
        -Tristan


More information about the Glade-users mailing list