#!/usr/bin/perl use warnings; use strict; use Tk; my $mw = tkinit; $mw->update; my $number; notify( $mw, "Notification Window #" . ++$number, 4000 ); $mw->repeat( 5000, sub { notify( $mw, "Notification Window #" . ++$number, 4000 ) } ); MainLoop; sub notify { my ( $mw, $message, $ms ) = @_; my $notification = $mw->Toplevel(); $notification->transient($mw); $notification->overrideredirect(1); $notification->Popup( -popanchor => 'c' ); my $frame = $notification->Frame( -border => 5, -relief => 'groove' )->pack; $frame->Label( -text => $message, )->pack( -padx => 5 ); $frame->Button( -text => 'OK', -command => sub { $notification->destroy; undef $notification }, )->pack( -pady => 5 ); $notification->after( $ms, sub { $notification->destroy } ); }