Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

So, I'm depeloping a Python/GTK app which, after showing an assistant, it hides the assistant's window and runs an external app. The problem is that window.hide() doesn't works if, after the command, there's an app call using os.system() or call(). When the call is done, the window seems to hang and it doesn't disappears until all the calls are done. So... what can be done?

share|improve this question
We are making a client/server app, and we have some troubles with gtk, it seams to lock our thread in the Gtk.main(). So we might be interested about using your solution, but where did you put those lines ? –  Audrey-ShowMyFaves Jun 24 '12 at 21:32
Yep, I had the same problem with an app which I've done. Let me check... –  espectalll123 Jun 24 '12 at 21:43
OK, it seems to fix the hanged thread error. Just insert it before the code which causes the problem, and done! :) –  espectalll123 Jun 24 '12 at 21:49
Wait... I'm not sure, try it anyway. –  espectalll123 Jun 24 '12 at 21:52

1 Answer 1

up vote 1 down vote accepted

After some time googling possible solutions, I've found this simple answer, which waits to GTK until it finished all its working tasks. You may think that makes the app slower, but the difference is almost unexistent.

This workaround can be used with any version of Python. It works with PyGTK and with GTK+3 (with GTK+3, change gtk per Gtk... :P )

while gtk.events_pending():

Just add this before the code which causes the problem... and done! :)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.