[pygtk] More pyGTK questions.

Frédéric frederic.mantegazza at gbiloba.org
Thu Nov 13 16:03:16 WST 2008


On jeudi 13 novembre 2008, Neil Munro wrote:

> Hey, again, have spent most of the day playing around and reading about
> python and glade and thus far this is what I have, now I have a few
> issues I have questions about, firstly how do I get the text associated
> with a toolbar button and change it for example if you notice the 'play'
> button when this is pressed I wish for the button to be renamed and
> re-iconed to 'pause' but have no idea how to do this or even if it's
> possible, I imagine so, but I don't actually know.

Just get the name of you menu entry (using wTree.get_widget() method), and 
change its properties. Then see documentation to retreive the properties 
associated with the menu entry.

> Secondly, while I have discovered a way to close a window by essentially
> crashing it in program what is the safest way to close a gtk window from
> within python, in my program here I have an about dialog box that opens,
> but when it closes it either takes the whole application with it (which
> I quickly corrected) or crashes un-gracefully and while the window
> appears to close, it's in fact crashed.

You don't need to bind OK/Cancel dialogs buttons signals; the dialogs will 
be closed as soon as you press OK or Cancel.

Look at my code, for example:

http://trac.gbiloba.org/papywizard/browser/trunk/papywizard/controller/generalInfoController.py

I bind signals just to make some special actions before the dialog is 
closed, but I don't cal a quit method.

-- 
    Frédéric

    http://www.gbiloba.org


More information about the pygtk mailing list