1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
| #!/usr/bin/perl
# be strict
use strict;
use warnings;
use Tk;
use Tk::Adjuster;
##########################################################
# #
# G U I #
# #
##########################################################
my $mw = new MainWindow;#ou MainWindow->new();
$mw->title ("My frame");
$mw->geometry("1200x600");
my $cell;
my @textSender;
my @textReceiver;
my @all_lines = (
'2', '1266619337', 'test',
'3', '1266624381', 'tsdfhsldjfhnsldkflksdjflks,dfssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssk:ds,fsdfsdfsdfsdfsdfsdfest',
'2', '1266625519', 'test',
'3','1266662837', "test",
'3','1266664673', "test",
'3','1266777388', "test",
'3',1266778423, "test",
'2',1266787476, "tesdfffffffffffffffffffffffqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfffffffffffffffffffffffffffft",
'2',1266787924, "test",
'3',1266788626, "test",
'2',1266790411, "test",
'3',1266796849, "test",
'2',1266797836, "test",
'3',1266957673, "test",
'2',1266959468, "test",
'3',1266962012, "test",
'2',1266966835, "test",
'3',1266968068, "test",
'3',1266969797, "test",
'3',1267005658, "test",
'2',1267006399, "test",
'2',1267035316, "test");
for my $i (0 .. 100) { #$#all_lines
$cell = $all_lines[$i];
if($i %3 == 0){#C'est un Flag
print $cell;
if($cell == "2"){ #Sender
push @textSender, scalar(localtime($all_lines[$i+1]));
push @textSender, $all_lines[$i+2];
}
if($cell == "3"){#Receiver
push @textReceiver, scalar(localtime($all_lines[$i+1]));
push @textReceiver, $all_lines[$i+2];
}
}
}
my $main_frame = $mw->Frame()->pack(-side => 'top', -fill => 'x');
my $adj = $mw -> Adjuster();
my $top_frame = $main_frame->Frame(-background => "red")->pack(-side => 'top',
-fill => 'x');
my $left_frame = $main_frame->Frame(-background => "SkyBlue1")->pack(-side => 'left',
-fill => 'y');
my $right_frame = $main_frame->Frame(-background => "SeaGreen3")->pack(-side => "right");
$top_frame->Label( -text => "Messages",
-background => "red")->pack(-side => "top");
$left_frame->Label( -text => join("\n",@textSender),
-background => "SkyBlue1",
-foreground => "black")->pack(-side => 'top');
$right_frame->Label(-text => join("\n",@textReceiver),
-background => "SeaGreen3",
-foreground => "black")->pack(-side => 'top');
#my $scroll = $main_frame->Scrollbar(-command => ['yview', $main_frame]);
#my $txt = $top_frame->Scrolled("Label",-scrollbars=>'w');
my $bouton = $mw->Button (
-text =>"Fermer",
-command => sub {exit;})->pack;
#$scroll->pack(-side => 'left', -fill => 'y');
$adj -> packAfter($left_frame, -side => 'left');
MainLoop; |
Partager