[pygtk] Glade interface and Dialog: buttons don't work

Marco Antonio Islas Cruz markuz at islascruz.org
Mon Aug 31 01:58:26 WST 2009


Try this:

gladeobj = gtk.glade.XML(gladeFile, 'dialog1')
dialog = gladeobj.get_widget('dialog1')
okButton = gladeobj.get_widget('okButton')
cancelButton = gladeobj.get_widget('cancelButton')

You are creating a new instance every time you call gtk.glade.XML, one
for the dialog, one for the okButton and one for the cancelButton,



On Sun, 2009-08-30 at 19:14 +0200, Fabrice DELENTE wrote:
> Hello.
> 
> I designed an interface with Glade, and I want to use it with PyGtk.
> 
> In this interface, there is a Window and a Dialog. The Dialog is popped up
> when I click a button in the Window.
> 
> I have a reference to the Dialog:
> 
> dialog = gtk.glade.XML(gladeFile, "dialog1").get_widget("dialog1")
> 
> and references to the two button that are in the action area:
> 
> okButton = gtk.glade.XML(gladeFile, "dialog1").get_widget("okButton")
> cancelButton = gtk.glade.XML(gladeFile, "dialog1").get_widget("cancelButton")
> 
> These buttons are connected to handlers in Glade: okButton's activate and
> clicked signals are connected to handleOkButton, and cancelButton's activate
> and clicked signals to handleCancelButton.
> 
> I have defined these handlesr:
> 
> def handleOkButton(widget):
>   print "ok button pressed"
> 
> def handleCancelButton(widget):
>   print "cancel button pressed"
> 
> but nothing happens when I pop up my Dialog with dialog.show_all() and I
> click either Ok or Cancel... I tried with dialog.run(), and it didn't worked
> either.
> 
> Any hint? Thanks!
> 
-- 
<--Linux... Because I'm Free-->
Marco Antonio Islas Cruz
"Markuz"
Linux User #280229
markuz at islascruz.org
markuz at unixmexico.org
markuz at linuxpozarica.com
marco.islas at gmail.com
islacruz at yahoo.com
http://www.islascruz.org
http://wwww.christine-project.org
http://www.linuxpozarica.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://www.daa.com.au/pipermail/pygtk/attachments/20090830/f22a1321/attachment.pgp 


More information about the pygtk mailing list