Re: Progress_bar failing to change



On 12/16/2014 09:12 PM, Ian Chapman wrote:
Spot on Hrvoje, that's my problem, many thanks for the help.  I'll have
to change the way I'm thinking.

The classic hack to update the progress bar without returning to the main loop is by running:

while (gtk_events_pending())
  gtk_main_iteration()

Still, be careful with this code because it can also trigger other queued events, such as user input, in places where you don't expect it.

A better approach is to structure your code so that a long-standing task is done in a separate thread, which uses idle_add to tell the GUI thread to update the progress bar (and anything else that might need updating).



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]