#include <gtk/gtk.h>
int main(int argc, char *argv[]) {
GtkWidget* window;
GtkWidget* fixed;
GtkWidget* button1;
GtkWidget* button2;
//设置主窗体
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window[......]
#include <gtk/gtk.h>
int main(int argc, char *argv[]) {
GtkWidget* window;
GtkWidget* fixed;
GtkWidget* button1;
GtkWidget* button2;
//设置主窗体
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window[......]
1、编译安装glib
wget http://ftp.gnome.org/pub/gnome/sources/glib/2.24/glib-2.24.2.tar.bz2
tar -xjvf glib-2.24.2.tar.bz2
cd glib-2.24.2/
./configure --prefix=/usr
make -j && make install
2、安装atk,cairo,tiff
sudo apt-get install sudo apt-get i[......]
http://zetcode.com/tutorials/gtktutorial/chinese/
非常棒![......]
[cpp]
/*
* main2.cc
*
* Created on: 2010-2-5
* Description:
* Copyright: 2010 @ ICT Li Heyuan
*/
#include <gtk/gtk.h>
typedef struct {
GtkWidget *user, *pass;
} pointer;
void closeApp(GtkWidget *window, gpointer data) {
gtk_mai[......]
解决方案:只找到一个一般的方法,把按钮放入fixed的容器中。
fixed = gtk_fixed_new();//一个fixed的容器,放入button
gtk_fixed_put(GTK_FIXED(fixed), button, 200, 0);
gtk_box_pack_start(GTK_BOX(vbox), fixed, FALSE, FALSE, 5);
然后把vbox放入window,运行后就能看到效果了。[......]