Reputation:
I have created a gtk window in init and then I process a new function and i append the values from new function to the gtk window till the second function completes, the window gets unresponsive and can become responsive when second function completes.
can anyone tell me whet should i do for the same?
Upvotes: 1
Views: 215
Reputation: 3855
Windows become unresponsive in gtk (and in windowing systems in general) when you call a function within the Event Loop, which is the thread in charge of keeping the window responsive (this thread repaints the window, handles mouse clicks, etc.). If the function you call returns immediately, you won't notice the unresponsiveness, but if the function makes some heavy work, you'll have the situation you have described in your question.
You should execute your second function in a thread of its own (a working thread). If you need to refresh your window after this function returns, make sure you make this update in the Event Loop (for example, invoking glib.idle_add) and not from the working thread! Otherwise, strange crashes may occur.
Upvotes: 2