#!/usr/bin/perl use strict; use diagnostics; use warnings; use Gtk3 '-init'; my $window = Gtk3::Window->new('toplevel'); $window->set_title('Hello world'); $window->set_position('center'); $window->set_default_size(500, 500); $window->signal_connect('delete-event' => sub { Gtk3->main_quit(); exit; }); $window->signal_connect('key-press-event' => sub { my ($widget, $event) = @_; print "keyval " . Gtk3::Gdk->keyval_name($event->keyval) . "\n"; }); $window->show_all(); Gtk3->main();