0

I'm trying to create a new message dialog with no buttons inside. It will be showing some info, and I'm having problems with programmatically close it after some function executes. I've read about run() and response() functions and written some code:

def stop():
    md.response(0)

md = gtk.MessageDialog(None, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_QUESTION, gtk.BUTTONS_NONE, "Wait... computing...")
print 'closing in 5 secs...'
threading.Timer(5.0, stop).start()
md.run()
md.destroy()

The problem is, stop() executes after closing main application window. And even if the above program would work correctly, it wouldn't do what I wanted. Any ideas for closing a message dialog after a function executes?

Best regards, mopsiok

mopsiok
  • 575
  • 1
  • 10
  • 19

1 Answers1

1

it is a realy hard work to make theaded gtk application. you will often end with a dead lock.

check in the doc of gtk for gtk.timeout_add.

ornoone
  • 651
  • 5
  • 11
  • Thanks for your answer. It works, but gtk.timeout_add loops the program too. Anyway, it's good to know about it, but I solved my problem in the other way (without showing info dialog). – mopsiok Mar 25 '13 at 18:20