Re: a lot of modal dialogs without GTK.main



On Fri, Feb 05, 2010 at 06:26:39PM +0300, Andrey Nikitin wrote:
But I noticed that dialog.destroy() call really does not destroy the
dialog window.

Have solution?

I found the solution, see my code (I use the excellent ruby gtk
binding) below:

Explicit main loop iterations are usually a sign of desperation.

============================================
import gtk

def response(dialog, id):
    print 'Dialog response:', id
    dialog.destroy()
    gtk.main_quit()

dialog = gtk.MessageDialog(buttons=gtk.BUTTONS_OK, message_format='Close me.')
dialog.connect('response', response)
dialog.show_all()
gtk.main()
print 'Done!'
# Ensure the program does not exit immediately
while True:
    pass
============================================

Yeti




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]