用GTK+写的HelloWorld.txt

时间:2011-10-02 08:39:25
【文件属性】:

文件名称:用GTK+写的HelloWorld.txt

文件大小:11KB

文件格式:TXT

更新时间:2011-10-02 08:39:25

用GTK+写的HelloWorld.txt

GtkWidget *window, *button; //初始化GTK+程序 gtk_init(&argc, &argv); //创建窗口,并为窗口的关闭信号加回调函数以便退出 window = gtk_window_new(GTK_WINDOW_TOPLEVEL); g_signal_connect(G_OBJECT(window),"delete_event", G_CALLBACK(gtk_main_quit),NULL); gtk_window_set_title(GTK_WINDOW(window),"Hello World!"); gtk_container_set_border_width(GTK_CONTAINER(window),10); //创建按钮控件,为单击信号加回调函数,将其放入窗口中 button=gtk_button_new_with_label("Hello World!"); g_signal_connect(G_OBJECT(button),"clicked", G_CALLBACK(on_button_clicked),(gpointer)"你好!\n*的世界。"); gtk_container_add(GTK_CONTAINER(window),button);


网友评论