#!/usr/bin/perl use strict; use warnings; use Tk; our $title = "title"; my $label = "label"; our $mw = MainWindow->new; $mw->title($title); # calculate max windows size my ($max_window_width,$max_window_height)=$mw->maxsize(); our $window_size_x = $max_window_width; our $window_size_y = 45; our $window_position_x = 0; our $window_position_y = 0; my $text_position_x = 0; my $text_position_y = 0; # Mainwindow: sizex/y, positionx/y $mw->geometry($window_size_x."x".$window_size_y."+".$window_position_x."+".$window_position_y); #prevents mw from closing $mw->protocol('WM_DELETE_WINDOW' => sub { Funct(); exit;} ); my $label_length = length($label); my ($pre_label, $post_label, $new_label); for (my $text_position_x = $max_window_width; $text_position_x >=0; $text_position_x = $text_position_x - 400) { # $pre_label = " " x $text_position_x; # $post_label = " " x ($max_window_width-$text_position_x-$label_length); # $new_label = $pre_label.$label.$post_label; $new_label = $label; banner($new_label, $text_position_x, $text_position_y); $mw->after(100); } #automatic close after time $mw->after(3000, sub { $mw->destroy; }); MainLoop; exit; ################################################### ################################################### ################################################### sub banner { my $label = shift; my $text_position_x = shift; my $text_position_y = shift; $mw->Label( -text => $label, -font => "Arial -40 bold") -> place (-x => $text_position_x, -y => $text_position_y); }