实际的应用中,往往有很多个控件, 同样GTK提供了很多种布局方案,Box, Fixed , Table , Grid 等。
接下来试试网格布局 Grid。...我们创建 example4.c ,内容如下:
#include
static void print_hello(GtkWidget *button , gpointer data...(app);
gtk_window_set_title(GTK_WINDOW(window) , "grid test");
// gtk_window_set_default_size(...gtk_container_set_border_width(GTK_CONTAINER(window) , 20);
gtk_container_add(GTK_CONTAINER(window...(gtk_widget_destroy) , window);
gtk_grid_attach(GTK_GRID(grid) , button , 1 , 1 , 2 , 1);