bwitherell
May 20th, 2009, 10:56 PM
Hello,
I am just learning python and I am having a bit of trouble closing a message dialog before my program sleeps.
Here is the block of code that I am having problems with:
import gtk
import time
message = "test"
dialog = gtk.MessageDialog(None, 0, gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, message)
#dialog.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)
response = dialog.run()
dialog.destroy()
time.sleep(10)
What happens is the dialog appears and with a yes and no button. If I click either of these buttons the program will sleep for 10 seconds before closing the dialog.
Why does the program sleep before destroying the dialog if dialog.destroy() is before time.sleep(10)?
What is wrong with my code? I have googled this for hours to no avail.
Any help I can get will be much appreciated.
Thank You.
I am just learning python and I am having a bit of trouble closing a message dialog before my program sleeps.
Here is the block of code that I am having problems with:
import gtk
import time
message = "test"
dialog = gtk.MessageDialog(None, 0, gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, message)
#dialog.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)
response = dialog.run()
dialog.destroy()
time.sleep(10)
What happens is the dialog appears and with a yes and no button. If I click either of these buttons the program will sleep for 10 seconds before closing the dialog.
Why does the program sleep before destroying the dialog if dialog.destroy() is before time.sleep(10)?
What is wrong with my code? I have googled this for hours to no avail.
Any help I can get will be much appreciated.
Thank You.