#include <gtk/gtk.h> #include <answer.h> void do_button1(GtkWidget *widget,gpointer data ) { } void do_button2(GtkWidget *widget,gpointer data ) { answer(); } void call() { GtkWidget *window; GtkWidget *button1; GtkWidget *button2; GtkWidget *label; GtkWidget *fixed = gtk_fixed_new(); window=gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (window),"call system"); gtk_window_set_position(GTK_WINDOW(window),GTK_WIN_POS_CENTER_ALWAYS ); //窗体居中 gtk_window_set_default_size(GTK_WINDOW(window),420,490); button1= gtk_button_new_with_label("Statement"); gtk_widget_set_size_request(button1,250,50); button2= gtk_button_new_with_label("call"); gtk_widget_set_size_request(button2,250,300); g_signal_connect (G_OBJECT(button1),"clicked",G_CALLBACK(do_button1),(gpointer)window); g_signal_connect (G_OBJECT(button2),"clicked",G_CALLBACK(do_button2),(gpointer)window); label=gtk_label_new(" call system"); gtk_widget_set_size_request(label,250,50); gtk_fixed_put(GTK_FIXED(fixed),button1,85, 25); gtk_fixed_put(GTK_FIXED(fixed),button2,85, 100); gtk_fixed_put(GTK_FIXED(fixed),label,85,415); gtk_container_add(GTK_CONTAINER(window),fixed); gtk_widget_show_all(window); gtk_main (); }