tags:

views:

195

answers:

1

I want to show a dialog box with an OK button that is disabled for a short period of time (perhaps 5 seconds). The other buttons would still need to be responsive during this time.

+3  A: 

You need a GTK+ timeout for that. First let the button be disabled. The timeout will call a function to enable the button.

Please not that for usability reasons, it should be visible for the user that a timer is running. You can do this by counting down, like "OK (5)", "Ok (4)" etc. until you enable the button.

See here: http://graphics.sci.ubu.ac.th/api/pygtk/tutorials/pygtk2tutorial/ch-TimeoutsIOAndIdleFunctions.html

The idea is to set the timeout to 1 second (1000 ms). Everytime the callback is called you change the button label and return TRUE. When your callback is called the 5th time, you enable it and return FALSE. This will remove the timeout.

ypnos