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 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213
| #! perl
use warnings;
use strict;
use utf8;
use Tk;
use Tk::LabFrame;
use Tk::ROText;
my ( $var, $tvar, $Ligne, $Message, $LabMessage );
my $fen = MainWindow->new;
my $width = $fen->screenwidth();
my $height = $fen->screenheight();
$fen->destroy();
# Creation du widget principal
my $Wm = MainWindow->new(
-width => $width,
-height => $height,
-title => "Mois",
-background => 'white',
);
$width = $Wm->screenwidth*(7/12);
$height = $Wm->screenheight*(5/10);
$Wm->configure(-height=>$height, -width=>$width, -title=>"Mois");
$Wm->geometry( $width ."x". $height );
$Wm->MoveToplevelWindow (100,0);
############################
# Scrolled qui affiche texte
my $widget_texte = $Wm->Scrolled(
'ROText',
-scrollbars => 'e',
-takefocus => 0,
-height => '1',
-wrap => 'word',
-relief => 'groove',
-background => '#ABFAA3',
);
configurer_tags($widget_texte);
# Cadre des configurations
my $couleur_commune = '#E0F0FF';
my $cadre_configuration_playlist = $Wm->Frame( -background => $couleur_commune, );
# Cadre pour lancer les lectures
my $cadre_playlist = $Wm->LabFrame(
-label => 'Gestion',
-background => $couleur_commune,
-font => '{Simplified Arabic} 10 {bold}',
);
# Exit
my $bouton_exit = $cadre_playlist->Button(
-text => 'يقفل',
-font => '{Simplified Arabic} 11 {bold}',
-command => [ \&fermer, ],
);
my $option_menu = $cadre_playlist->Optionmenu(
-options => [
[ Janvier => 1 ], [ Février => 2 ],
[ Mars => 3 ], [ Avril => 4 ],
[ Mai => 5], [ Juin => 6 ],
[ Juillet => 7 ], [ Août => 8 ],
[ Septembre => 9 ], [ Octobre => 10 ],
],
-font => '{Simplified Arabic} 14 {bold}',
-anchor => 'e',
-command => sub { print "choix : ", @_, "\n" },
-variable => \$var,
-textvariable => \$tvar,
);
$option_menu->addOptions( [ 'نوفمبر' => 11 ], [ 'ديسمبر' => 12 ], );
#$option_menu->configure ( -font => "{Simplified Arabic} 14 {bold}", -justify => 'right', );
#$option_menu->configure ( -font => "{Simplified Arabic} 14 {bold}", -anchor => 'e', );
$option_menu->entryconfigure (12, -font => "{Simplified Arabic} 16 {bold}", );
$option_menu->entryconfigure (1, -font => "{Simplified Arabic} 16 {bold}", );
####################################
# Cadre pour les messages de service
my $cadre_messages = $Wm->Frame( -background => $couleur_commune, );
# Label qui affichera 'choix'
my $label_choix = $cadre_messages->Label(
-text => ' : خيار',
-width => 15,
-background => '#FFE0D0',
-relief => 'groove',
);
# Label qui affichera le mois
my $label_lib_mois = $cadre_messages->Label(
-textvariable => \$tvar,
# -justify => 'right',
-anchor => 'e',
-width => 20,
-background => '#FFE0D0',
-relief => 'groove',
);
# Label qui affichera le numéro du mois
my $label_num_mois = $cadre_messages->Label(
-textvariable => \$var,
-width => 5,
-background => '#FFE0D0',
-relief => 'groove',
);
# Label qui affichera les messages, en bas
my $label_etat = $cadre_messages->Label(
-textvariable => \$Message,
-background => '#FFE0D0',
-relief => 'groove',
);
# Label qui affichera les messages, en bas
my $label_message = $cadre_messages->Label(
-textvariable => \$LabMessage,
-background => '#FFE0D0',
-relief => 'groove',
);
######################################################################
# Construction interface graphique
$cadre_messages->pack(qw / -side bottom -fill both -expand 0 /);
$label_choix->pack (qw / -side right -fill both -expand 0 /);
$label_lib_mois->pack(qw / -side right -fill both -expand 0 /);
$label_num_mois->pack(qw / -side right -fill both -expand 0 /);
$label_message->pack (qw / -side right -fill both -expand 1 /);
$widget_texte->pack(qw / -side bottom -fill both -expand 1 /);
$cadre_playlist->pack(qw / -side right -fill both -expand 1 /);
$bouton_exit->pack( $option_menu,
qw / -side right -padx 2 -pady 5 / );
#$option_menu->pack( qw / -side right / );
Start();
MainLoop;
#####
sub Start {
$Message = 'Coucou';
$LabMessage = $Message;
$Ligne = 'هَلْ تُحِبُّ فَاطِمَة السَّفَرَ بِالطَّائِرَةِ ؟';
$widget_texte->insert( 'end', $Ligne, "d18" );
$Ligne = "\n";
$widget_texte->insert( 'end', $Ligne, "d14" );
$Ligne = 'لم أخل من حسد عليك فلا تضع ';
$widget_texte->insert( 'end', $Ligne, "d14" );
}
################################################################################
sub fermer {
$Wm->destroy;
exit (0);
}
#########################################
# Configuration des polices de caractères
#
sub configurer_tags {
my $widget_text = shift;
for my $police ( 12 .. 72 ) {
if ( $police % 2 == 0 ) {
$widget_text->tagConfigure(
"g$police",
-background => '#ABFAA3',
-foreground => '#FF0000',
-font => "{Simplified Arabic} $police {bold}",
-justify => 'left',
);
$widget_text->tagConfigure(
"c$police",
-background => '#ABFAA3',
-foreground => '#FF0000',
-font => "{Simplified Arabic} $police {bold}",
-justify => 'center',
);
$widget_text->tagConfigure(
"d$police",
-background => '#ABFAA3',
-foreground => '#FF0000',
-font => "{Simplified Arabic} $police {bold}",
-justify => 'right',
);
}
}
return;
} |
Partager