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
|
use Tk;
$mw = MainWindow -> new();
$mw -> title("BB!");
$mw->geometry("300x100");
$b_menu = $mw -> Frame(-relief => 'groove', -borderwidth => 2);
$menu_app = $b_menu -> Menubutton (-text => "File",
-tearoff => 0,
-relief => 'ridge',
-menuitems => [
['command' => "Create new TLSE",-command => \&create_tlse],
['command' => "Delete TLSE",-command => \&delete_tlse],
['command' => "Exit",-command => sub {exit;}]
]
);
$menu_app -> pack(-side => 'left');
$b_menu -> pack(-side => 'top', -anchor => 'n', -fill => 'x');
#Frame containing all TLSE
$all_tlse = $mw -> Frame(-relief => 'raised', -borderwidth => 2) -> pack();
$end = $mw -> Label(-relief => 'groove', -text => "2010", -font => '{Garamond} 10') -> pack (-side => 'bottom', -fill => 'both');
MainLoop;
#---------------------Subfonction------------------------------
sub create_tlse {
$tlse_creation = $mw -> Toplevel();
$tlse_creation_title = $tlse_creation -> Label(-text => "Create a new TLSE") -> pack();
$ent_name = $tlse_creation -> Entry() -> pack();
$valid_button = $tlse_creation -> Button(-text => "Create", command => \&tlse) -> pack(-side => 'left');
$but_close = $tlse_creation -> Button(-text=> "Close", -command => sub{ destroy $tlse_creation; }) -> pack();
}
sub tlse {
#Frame TLSE
$tlse_name = $all_tlse -> Frame(-relief => 'groove', -borderwidth => 2) -> pack(-side => 'left');
$name = $ent_name -> get();
#create the entry in the bb file
$bb_base = "TLSE-data.bb";
open(FILE,">>$bb_base") or die ("problem to open the bb file.");
print FILE "\n";
print FILE $name;
#By default, at the TLSE creation, the workload is set to 0
print FILE ";0;";
close FILE;
$lb_name = $tlse_name -> Label(-text => "$name") -> pack(-side => 'top');
#By default, at the TLSE creation, the workload is set to 0
$lb_workload = $tlse_name -> Label(-text => "0") -> pack();
$minus_button = $tlse_name -> Button(-text => "-", command => \&push_minus) -> pack(-side => 'left');
$plus_button = $tlse_name -> Button(-text => "+", command => \&push_plus) -> pack(-side => 'right');
}
sub push_plus {
}
1; |
Partager