Re: a lot of modal dialogs without GTK.main



On Sat, Feb 06, 2010 at 12:27:47PM +0300, Andrey Nikitin wrote:
Explicit main loop iterations are usually a sign of desperation.

Really? :)
Try to change your example (with finally gtk.main()) to consecutive run
several dialogs.

You mean something like this?

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

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

while True:
    dialog = gtk.MessageDialog(buttons=gtk.BUTTONS_OK, message_format='Close me.')
    dialog.connect('response', response)
    dialog.show_all()
    gtk.main()
    print 'Done!'
===============================================================

Works perfectly.

Yeti




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