对应http://zetcode.com/tutorials/gtktutorial/chinese/firstprograms/
#include <gtk/gtk.h> //编译使用:gcc 文件名 `pkg-config --libs --cflags gtk+-2.0` //所有注释仅为我的理解 int main( int argc, char *argv[]) { GtkWidget *window; gtk_init(&argc, &argv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
//本次的窗口构建内容
//设置标题
gtk_window_set_title(GTK_WINDOW(window),"This is the TITLE");
//设置大小
gtk_window_set_default_size(GTK_WINDOW(window),400,300);
//设置位置,又有一个常数
gtk_window_set_position(GTK_WINDOW(window),GTK_WIN_POS_CENTER);
gtk_widget_show(window);
//处理关闭的信号,此法方能正常退出
g_signal_connect_swapped(G_OBJECT(window),"destroy",G_CALLBACK(gtk_main_quit),NULL);
gtk_main();
return 0;
}