入門套件

#include <gtk/gtk.h>
static void destroy(GtkWidget *widget, gpointer data)
{
gtk_main_quit();
}
int main(int argc, char *argv[])
{
gtk_init(&argc, &argv);
GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window), "Window");
g_signal_connect(window, "destroy", G_CALLBACK(destroy), NULL);

GtkWidget *k;
k= gtk_fixed_new();
    gtk_container_add(GTK_CONTAINER(window), k);

       GtkWidget* la,*r;
    la = gtk_button_new_with_label (",mkl");
     gtk_fixed_put (GTK_FIXED (k), la,50,237);
    gtk_widget_set_size_request(la, 98, 90);
//    gtk_container_set_border_width(GTK_CONTAINER (la)    , 5);

    r = gtk_button_new_with_label (",kii");
     gtk_fixed_put (GTK_FIXED (k), r,150,237);
    gtk_widget_set_size_request(r, 98, 90);

    gtk_widget_set_size_request(GTK_WIDGET(window),300,349);
gtk_widget_show_all(GTK_WIDGET(window));

gtk_main();
return 0;
}

編譯:

c++ starterkit.c `pkg-config --libs --cflags gtk+-3.0` -o p

./p