![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
mini-application |
12/12/2005 |
Exemple de convertisseur d'unité: Attention, il faut avoir les images associées.
#!/bin/sh # the next line restarts using wish \ exec wish "$0" "$@" set images [file dirname $argv0]/images label .titre -text "Conversion francs/euros" -font "bold" pack .titre label .lfr -image [image create photo -file $images/frf.gif] entry .franc -width 10 -textvariable franc -justify right pack .franc .lfr -side left label .leu -image [image create photo -file $images/eur.gif] entry .euro -width 10 -textvariable euro -justify right pack .euro .leu -side left bind .franc{set euro [format %%.2f [expr ([string map {, .} $franc]) / 6.55957]]} bind .euro {set franc [format %%.2f [expr ([string map {, .} $euro]) * 6.55957]]} # Attrape toutes les erreurs de saisie proc bgerror {e} { bell foreach i {.franc .euro} { $i delete 0 end ;# Vide le champ $i insert 0 0.00 ;# Met 0.00 dans le champ $i icursor 1 ;# Positionne le curseur avant l '.' } }
fonctions