#include <gtk/gtk.h> static void on_button_clicked(GtkWidget *widget, gpointer data) { GtkWidget *label = (GtkWidget *)data; gtk_label_set_text(GTK_LABEL(label), "Der Button wurde geklickt!"); } int main(int argc, char *argv[]) { GtkWidget *window; GtkWidget *button; GtkWidget *label; GtkWidget *vbox; gtk_init(&argc, &argv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(window), "Erweitertes GTK+3.0 Programm"); gtk_window_set_default_size(GTK_WINDOW(window), 300, 200); g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL); vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5); gtk_container_add(GTK_CONTAINER(window), vbox); label = gtk_label_new("Willkommen zu meinem GTK+3.0 Programm!"); gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0); button = gtk_button_new_with_label("Klicken Sie mich!"); g_signal_connect(button, "clicked", G_CALLBACK(on_button_clicked), label); gtk_box_pack_start(GTK_BOX(vbox), button, TRUE, TRUE, 0); gtk_widget_show_all(window); gtk_main(); return 0; }