#include <gtk/gtk.h> #include "answer.h" void answers( GtkWidget *widget,gpointer data ) { gtk_widget_hide(data); answer(); } int request( ) { GtkWidget *window; GtkWidget *button; GtkWidget *label1; GtkWidget *label2; GtkWidget *label3; GtkWidget *label4; GtkWidget *label5; GtkWidget *button1; GtkWidget *table; window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (window), "叫号系统"); gtk_window_set_default_size(GTK_WINDOW(window), 500, 500); gtk_window_set_position(GTK_WINDOW(window),GTK_WIN_POS_CENTER_ALWAYS ); gtk_container_set_border_width (GTK_CONTAINER (window), 30); table = gtk_table_new (8, 3, TRUE); gtk_container_add (GTK_CONTAINER (window), table); label1 = gtk_label_new ("柜台1服务情况"); label2= gtk_label_new ("柜台2服务情况"); label3 = gtk_label_new ("柜台3服务情况"); label4 = gtk_label_new ("柜台4服务情况"); label5 = gtk_label_new ("目前排队人数"); //button = gtk_button_new_with_label ("welcome!"); button1 = gtk_button_new_with_label ("叫号"); g_signal_connect (G_OBJECT (button1), "clicked",G_CALLBACK (answers), (gpointer) window); //gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 4); gtk_table_attach_defaults (GTK_TABLE (table), label1, 0, 1, 3, 4); gtk_table_attach_defaults (GTK_TABLE (table), label2, 0, 1, 4, 5); gtk_table_attach_defaults (GTK_TABLE (table), label3, 0, 1, 5, 6); gtk_table_attach_defaults (GTK_TABLE (table), label4, 0, 1, 6, 7); gtk_table_attach_defaults (GTK_TABLE (table), button1, 1, 3, 1, 6); gtk_table_attach_defaults (GTK_TABLE (table), label5, 1, 3, 6, 7); gtk_widget_show_all(window); gtk_main (); return 0; }
时间: 2024-11-13 06:34:44