package window; use strict; use warnings; use Tk; sub new { my $this = shift; my $self = {}; bless ($self, $this); return $self; } sub set_xy { my $this = shift; if(@_) {$this->{'windowHeight'} = shift}; if(@_) {$this->{'windowWidth'} = shift}; } sub set_tittle { my $this = shift; if(@_) {$this->{'tittle'} = shift}; } sub set_window { my $this = shift; my $mw = MainWindow->new(); $mw->title($this->{'tittle'}); my $screenHeight = $mw->screenheight; my $screenWidth = $mw->screenwidth; $mw->geometry($this->{'windowWidth'} . "x" . $this->{'windowHeight'}); $mw->geometry("+" . int($screenWidth/2 - $this->{'windowWidth'}/2) . "+" . int($screenHeight/2 - $this->{'windowHeight'}/2)); Mainloop(); }