Tuesday, April 30, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 2274  / 2 Years ago, sun, january 2, 2022, 12:33:43

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?


More From » python

 Answers
7

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():
gtk.main_iteration()


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


[#37313] Monday, January 3, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
enefiama

Total Points: 43
Total Questions: 125
Total Answers: 102

Location: Gabon
Member since Sat, Jul 25, 2020
4 Years ago
enefiama questions
;