How to show and hide an image from other thread in C/GTK3

,

Hi gays, can you help me.
I create my grid and images with this:

for (int row = 0; row < ITEMS; row++) {
        gtk_grid_insert_row(GTK_GRID(grid), row);

        for (int col = 0; col < ITEMS; col++) {
            img[row][col] = gtk_image_new_from_file("caballo.png");
            gtk_grid_attach(GTK_GRID(grid), img[row][col], col, row, 1, 1);
            //g_signal_connect(img[row][col], "clicked", G_CALLBACK(on_move), NULL);

        }
    }

And then, into a thread I want to show my image with this:
gtk_widget_show(img[cur_row][cur_col]);

Invoke a callback of your code via g_main_context_invoke(), ala https://github.com/baedert/corebird/blob/master/src/CbMedia.c#L117-L119

1 Like

Thank you @baedert for your answer but, I found this that work for me:

g_idle_add((GSourceFunc)moveTop, NULL);

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.