用gtk实现教务管理系统代码

更新时间:2024-04-30 13:25:01 阅读量: 综合文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

#include GtkWidget *name;

void button_event(GtkWidget *widget,gpointer *data) {

const gchar *uname;

uname=(gchar*)malloc(sizeof(gchar));

uname=gtk_entry_get_text(GTK_ENTRY(name)); g_print(\}

int main(int argc,char *argv[]) {

GtkWidget*window; GtkWidget*button1; GtkWidget*button2; GtkWidget*label; GtkWidget*label1; GtkWidget*label2; GtkWidget*box; GtkWidget*box1; GtkWidget*box2; GtkWidget*box3; GtkWidget*box4;

GtkWidget*studentnum; GtkWidget*classnum;

gtk_init(&argc,&argv);

window=gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(window),\

gtk_window_set_default_size(GTK_WINDOW(window),250,200);

gtk_window_set_position(GTK_WINDOW(window),GTK_WIN_POS_CENTER);

gtk_signal_connect(GTK_OBJECT(window),\ box3=gtk_vbox_new(FALSE,0);

gtk_container_add(GTK_CONTAINER(window),box3);

box1=gtk_hbox_new(FALSE,0);

label1=gtk_label_new(\

gtk_box_pack_start(GTK_BOX(box1),label1,FALSE,FALSE,0); gtk_widget_show(label1); studentnum=gtk_entry_new();

gtk_widget_set_size_request(studentnum,200,30);

gtk_box_pack_start(GTK_BOX(box1),studentnum,FALSE,FALSE,0); gtk_widget_show(studentnum);

gtk_container_add(GTK_CONTAINER(box3),box1);

box2=gtk_hbox_new(FALSE,0); label2=gtk_label_new(\

gtk_box_pack_start(GTK_BOX(box2),label2,FALSE,FALSE,0); gtk_widget_show(label2); classnum=gtk_entry_new();

gtk_widget_set_size_request(classnum,200,30);

gtk_box_pack_start(GTK_BOX(box2),classnum,FALSE,FALSE,0); gtk_widget_show(classnum);

gtk_container_add(GTK_CONTAINER(box3),box2);

box4=gtk_hbox_new(FALSE,0);

button1=gtk_button_new_with_label(\ gtk_widget_set_size_request(button1,100,5);

gtk_box_pack_start(GTK_BOX(box4),button1,FALSE,FALSE,50); gtk_signal_connect(GTK_OBJECT(button1),\ GTK_SIGNAL_FUNC(button_event),\ gtk_widget_show(button1);

button2=gtk_button_new_with_label(\ gtk_widget_set_size_request(button2,100,5);

gtk_box_pack_start(GTK_BOX(box4),button2,FALSE,FALSE,50); gtk_signal_connect(GTK_OBJECT(button2),\ GTK_SIGNAL_FUNC(button_event),\ gtk_widget_show(button2);

gtk_container_add(GTK_CONTAINER(box3),box4);

gtk_widget_show(box1); gtk_widget_show(box2); gtk_widget_show(box3); gtk_widget_show(box4);

gtk_widget_show_all(window); gtk_main(); return 0; }

本文来源:https://www.bwwdw.com/article/2ang.html

Top