package QueryWindow; require Tk; use Tk; use threads; sub new() { my $proto = shift; my($nick, $address, $text) = @_; my $class = ref($proto) || $proto; bless { 'QUERY_NICK' => $nick, 'QUERY_ADDRESS' => $addr, 'QUERY_TEXT' => $text }, $class } sub OpenWindow() { my $self = shift; my $window = MainWindow->new(); $window->configure(-title => "Query From: $self->{QUERY_NICK}", -background => 'black'); $window->geometry('+500+50'); my $frame = $window->Frame(-relief => 'groove', -borderwidth => 3, -background => 'black' )->pack(-side => 'left'); my $label_1 = $frame->Label(-text => 'Message:', -background => 'black', -foreground => 'white' )->pack(-side => 'left'); my $label_2 = $frame->Label(-text => $self->{QUERY_TEXT}, -background => 'white', -foreground => 'black' )->pack(-side => 'left'); my $button_accept = $frame->Button(-text => 'Accept', -background => 'grey', -command => [\&cmd_accept, $self] )->pack(-side => 'bottom', -anchor => 'center', -pady => 5, -padx => 3); my $button_decline = $frame->Button(-text => 'Decline', -background => 'grey', -command => [\&cmd_decline, $self] )->pack(-side => 'bottom', -anchor => 'center', -pady => 5, -padx => 3); ); my $complete = threads->create(\&MainLoop()); } 1;