Le 19/12/2008, "John Finlay" <fin...@moeraki.com> a écrit:

> Frédéric wrote:
>> 
>> It seems that all documentation related to that point refer to gtk.Window
>> widgets, and it works fine. But if the main window opens a gtk.Dialog,
>> then, it is impossible to avoid this dialog to be destroyed when hitting
>> its X box: even if event-delete callback returns True, the signal is
>> propagated, and the destroy signal is emited.
>
>Could you create a small, self-contained program to illustrate the
>problem you are having?

Sure:

import gtk

def delete(widget, event):
    print "delete()"
    return True # Should not propagate delete-event

def destroy(widget):
    print "destroy()"
    return True

def clicked(widget):
    print "clicked()"
    dialog = gtk.Dialog("My dialog", win,
                         gtk.DIALOG_MODAL,
                         (gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
    dialog.set_size_request(200, 50)
    dialog.show()
    dialog.connect("delete-event", delete)
    dialog.connect("destroy", destroy)
    dialog.run()
    dialog.destroy()

win = gtk.Window()
win.set_size_request(200, 50)
button = gtk.Button("Open dialog...")
button.connect("clicked", clicked)
win.add(button)
win.connect("delete-event", gtk.main_quit)
win.show_all()
gtk.main()


--
   Frédéric
_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to