# for c version zentara 15 0 14368 7012 5400 S 0.0 0.7 0:00 .07 ./basic-window-c #for the Perl version zentara 18 0 21700 12m 9056 S 0.0 1.3 0:00 12 ./basic-window.pl #### /* compile test-c.c with gcc -o test-c test-c.c `pkg-config --cflags --libs gtk+-2.0` */ #include void destroy(GtkWidget *widget, gpointer data) { gtk_main_quit(); } int main(int argc, char *argv[]) { GtkWidget *window; GtkWidget *button; gtk_init(&argc, &argv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK(destroy), 1); gtk_container_set_border_width(GTK_CONTAINER (window), 10); button = gtk_button_new_with_label ("Some Button"); gtk_container_add(GTK_CONTAINER(window), button); gtk_widget_show(button); gtk_widget_show (window); gtk_main (); return 0; } #### #!/usr/bin/perl use warnings; use strict; use Gtk2 '-init'; my $window = Gtk2::Window->new; my $button = Gtk2::Button->new('Some Button'); my $vbox = Gtk2::VBox->new(); $window->set( border_width => 15 ); $window->add($button); $window->signal_connect('destroy', sub { Gtk2->main_quit }); $window->show_all(); Gtk2->main;