(I am not subscribed to gtk-app-dev list, as I already get more mail from
the GNOME lists than I can read at times. If you want, forward this on
Jeff)
The GLADE support in python is different from the C glade support.
Whereas the C code generator outputs code that you compile and then run to
create the interface (ie. it has compile time interface generation),
pygtk's GLADE support is runtime. To use it, your code should import the
pyglade module (well it is actually a package, but you can treat it as a
single module).
>From here, you can call the construct function which takes a string
argument giving the XML file to parse:
wtree = pyglade.construct("/tmp/tester.glade")
This will construct the interface for you. The function will return an
instance of WidgetTree, which can be used to get the individual widgets
defined in the XML, and connect python functions to the signal handlers
defined in the XML. The methods you need to know about are these:
wtree.get_widget("widget_name")
- get widget with this name
wtree.connect("signal-name", handler, [extra args, ...])
- connect to handler to the signals which have signal-name listed as
their signal handler in the XML file.
wtree.disconnect("signal-name")
- disconnect all handlers from this handler name.
The XML parser is a simple one of my own, and will probably fail for any
particularly complicated XML file (I have been meaning to switch over to
some other parser like xmllib.py, but haven't had the time to write a
wrapper for it).
That is about all that you need to know to use GLADE with pygtk (BTW, If
you think runtime interface generation is a good idea and you would like
to use it for your C program, check out the libglade module from the GNOME
CVS tree. It offers a similar interface for C programs).
James Henstridge.
--
Email: [EMAIL PROTECTED]
WWW: http://www.daa.com.au/~james/
On Tue, 23 Feb 1999, J.W. Bizzaro wrote:
> Tom Jenkins posted on the gtk-app-dev list:
>
> >> This binding is in a very good shape and its authors are furiousely working
> >> on it right now. Full support for glade is under its way, and GtkAda will
> >> also provide a full support for dynamic creation of widgets from a glade's
> >> XML file (I've heard that the Python binding has some restricted similar
> >> functionnalities, but I've seen nothing for the other bindings).
> >>
> > Where can I find information on glade support of python (if i'm reading
> > this correctly)?
>
> Can anyone answer this? Is there an XML that GLADE uses to make PyGTK apps?
>
>
> Jeff
> --
> J.W. Bizzaro Phone: 617-552-3905
> Boston College mailto:[EMAIL PROTECTED]
> Department of Chemistry http://www.uml.edu/Dept/Chem/Bizzaro/
> --
> To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
>
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]