Calculatrice en picwin

Contenu du snippet

Une calculatice en PicWin pour changer :)
Pour l'ouvrir tapez : /calc

Source / Exemple :


alias calc { 
  unset %calc 
  unset %calc2 
  window -BCdg0k0pRz +dl @Calc 0 0 327 134 
  drawfill -r @calc $rgb(218,240,252) 1 10 10 
  drawrect -f @calc 2 2 0 0 327 15 
  drawtext -roc @calc $rgb(250,250,250) Tahoma 10 5 3 200 20 Calculatrice par atlantisfr 
  drawrect @calc 2 2 0 15 327 119 
  drawrect @calc 2 2 0 15 337 129 
  drawrect -f @calc 4 2 314 3 11 11 
  drawrect @calc 0 1 314 3 11 11 
  drawrect -f @calc 3 2 301 3 11 11 
  drawrect @calc 0 1 301 3 11 11 
  drawrect -f @calc 15 2 5 20 156 17 
  drawrect @calc 2 2 5 20 156 17 
  drawrect -f @calc 15 2 5 40 156 17 
  drawrect @calc 2 2 5 40 156 17 
  drawrect -f @calc 15 2 5 60 50 15 
  drawrect @calc 2 2 5 60 50 15 
  drawtext -oc @calc 2 Tahoma 10 27 61 60 20 9 
  drawrect -f @calc 15 2 58 60 50 15 
  drawrect @calc 2 2 58 60 50 15 
  drawtext -oc @calc 2 Tahoma 10 80 61 60 20 8 
  drawrect -f @calc 15 2 111 60 50 15 
  drawrect @calc 2 2 111 60 50 15 
  drawtext -oc @calc 2 Tahoma 10 133 61 60 20 7 
  drawrect -f @calc 15 2 5 78 50 15 
  drawrect @calc 2 2 5 78 50 15 
  drawtext -oc @calc 2 Tahoma 10 27 79 60 20 6 
  drawrect -f @calc 15 2 58 78 50 15 
  drawrect @calc 2 2 58 78 50 15 
  drawtext -oc @calc 2 Tahoma 10 80 79 60 20 5 
  drawrect -f @calc 15 2 111 78 50 15 
  drawrect @calc 2 2 111 78 50 15 
  drawtext -oc @calc 2 Tahoma 10 133 79 60 20 4 
  drawrect -f @calc 15 2 5 96 50 15 
  drawrect @calc 2 2 5 96 50 15 
  drawtext -oc @calc 2 Tahoma 10 27 97 60 20 3 
  drawrect -f @calc 15 2 58 96 50 15 
  drawrect @calc 2 2 58 96 50 15 
  drawtext -oc @calc 2 Tahoma 10 80 97 60 20 2 
  drawrect -f @calc 15 2 111 96 50 15 
  drawrect @calc 2 2 111 96 50 15 
  drawtext -oc @calc 2 Tahoma 10 133 97 60 20 1 
  drawrect -f @calc 15 2 5 114 50 15 
  drawrect @calc 2 2 5 114 50 15 
  drawtext -oc @calc 2 Tahoma 10 27 115 60 20 0 
  drawrect -f @calc 15 2 58 114 50 15 
  drawrect @calc 2 2 58 114 50 15 
  drawtext -oc @calc 2 Tahoma 10 77 115 60 20 00 
  drawrect -f @calc 15 2 111 114 50 15 
  drawrect @calc 2 2 111 114 50 15 
  drawtext -oc @calc 2 Tahoma 10 135 112 60 20 , 
  drawline @calc 2 2 165 20 165 128 
  drawrect -f @calc 15 2 169 20 75 15 
  drawrect @calc 2 2 169 20 75 15 
  drawtext -oc @calc 2 Tahoma 10 203 21 60 20 + 
  drawrect -f @calc 15 2 247 20 75 15 
  drawrect @calc 2 2 247 20 75 15 
  drawtext -oc @calc 2 Tahoma 10 282 21 60 20 - 
  drawrect -f @calc 15 2 169 38 75 15 
  drawrect @calc 2 2 169 38 75 15 
  drawtext -oc @calc 2 Tahoma 10 204 39 60 20 x 
  drawrect -f @calc 15 2 247 38 75 15 
  drawrect @calc 2 2 247 38 75 15 
  drawtext -oc @calc 2 Tahoma 10 280 39 60 20 ÷ 
  drawrect -f @calc 15 2 169 56 36 15 
  drawrect @calc 2 2 169 56 36 15 
  drawtext -oc @calc 2 Tahoma 9 185 58 60 20 ( 
  drawrect -f @calc 15 2 208 56 36 15 
  drawrect @calc 2 2 208 56 36 15 
  drawtext -oc @calc 2 Tahoma 9 224 58 60 20 ) 
  drawrect -f @calc 15 2 247 56 75 15 
  drawrect @calc 2 2 247 56 75 15 
  drawtext -oc @calc 2 Tahoma 10 280 57 60 20 % 
  drawrect -f @calc 15 2 169 74 75 15 
  drawrect @calc 2 2 169 74 75 15 
  drawtext -oc @calc 2 Tahoma 10 185 75 60 20 Au carré 
  drawrect -f @calc 15 2 247 74 76 15 
  drawrect @calc 2 2 247 74 75 15 
  drawtext -oc @calc 2 Tahoma 10 280 75 60 20 Pi 
  drawrect -f @calc 15 2 169 92 76 15 
  drawrect @calc 2 2 169 92 76 15 
  drawtext -oc @calc 2 Tahoma 10 202 93 60 20 = 
  drawrect -f @calc 15 2 247 92 76 15 
  drawrect @calc 2 2 247 92 75 15 
  drawtext -oc @calc 2 Tahoma 10 267 93 60 20 Effacer 
  drawline @calc 2 2 169 111 321 111 
  drawrect -f @calc 15 2 169 114 153 15 
  drawrect @calc 2 2 169 114 153 15 
  drawtext -oc @calc 2 Tahoma 10 228 115 60 20 Fermer 
} 

alias -l calc.move { 
  if ($window(@calc)) window @calc $calc($mouse.dx - $1) $calc($mouse.dy - $2) 
  if ($mouse.key & 1) .timer $+ $ticks -m 1 0 calc.move $1- 
} 

menu @calc { 
  sclick { 
    if ($mouse.y < 15) { calc.move $calc($mouse.dx - $window($active).x) $calc($mouse.dy - $window($active).y) } 
    if $inrect($mouse.x,$mouse.y,314,3,11,11) { window -c @calc } 
    if $inrect($mouse.x,$mouse.y,301,3,11,11) { window -n @calc } 
    if ($inrect($mouse.x,$mouse.y,5,60,50,15)) { set %calc %calc $+ 9 | drawrect -f @calc 15 2 5 20 156 17 | drawrect @calc 2 2 5 20 156 17 | drawtext -oc @calc 2 Tahoma 10 10 22 150 20 $replace(%calc,*,x,/,÷) } 
    if ($inrect($mouse.x,$mouse.y,58,60,50,15)) { set %calc %calc $+ 8 | drawrect -f @calc 15 2 5 20 156 17 | drawrect @calc 2 2 5 20 156 17 | drawtext -oc @calc 2 Tahoma 10 10 22 150 20 $replace(%calc,*,x,/,÷) } 
    if ($inrect($mouse.x,$mouse.y,111,60,50,15)) { set %calc %calc $+ 7 | drawrect -f @calc 15 2 5 20 156 17 | drawrect @calc 2 2 5 20 156 17 | drawtext -oc @calc 2 Tahoma 10 10 22 150 20 $replace(%calc,*,x,/,÷) } 
    if ($inrect($mouse.x,$mouse.y,5,78,50,15)) { set %calc %calc $+ 6 | drawrect -f @calc 15 2 5 20 156 17 | drawrect @calc 2 2 5 20 156 17 | drawtext -oc @calc 2 Tahoma 10 10 22 150 20 $replace(%calc,*,x,/,÷) } 
    if ($inrect($mouse.x,$mouse.y,58,78,50,15)) { set %calc %calc $+ 5 | drawrect -f @calc 15 2 5 20 156 17 | drawrect @calc 2 2 5 20 156 17 | drawtext -oc @calc 2 Tahoma 10 10 22 150 20 $replace(%calc,*,x,/,÷) } 
    if ($inrect($mouse.x,$mouse.y,111,78,50,15)) { set %calc %calc $+ 4 | drawrect -f @calc 15 2 5 20 156 17 | drawrect @calc 2 2 5 20 156 17 | drawtext -oc @calc 2 Tahoma 10 10 22 150 20 $replace(%calc,*,x,/,÷) } 
    if ($inrect($mouse.x,$mouse.y,5,96,50,15)) { set %calc %calc $+ 3 | drawrect -f @calc 15 2 5 20 156 17 | drawrect @calc 2 2 5 20 156 17 | drawtext -oc @calc 2 Tahoma 10 10 22 150 20 $replace(%calc,*,x,/,÷) } 
    if ($inrect($mouse.x,$mouse.y,58,96,50,15)) { set %calc %calc $+ 2 | drawrect -f @calc 15 2 5 20 156 17 | drawrect @calc 2 2 5 20 156 17 | drawtext -oc @calc 2 Tahoma 10 10 22 150 20 $replace(%calc,*,x,/,÷) } 
    if ($inrect($mouse.x,$mouse.y,111,96,50,15)) { set %calc %calc $+ 1 | drawrect -f @calc 15 2 5 20 156 17 | drawrect @calc 2 2 5 20 156 17 | drawtext -oc @calc 2 Tahoma 10 10 22 150 20 $replace(%calc,*,x,/,÷) } 
    if ($inrect($mouse.x,$mouse.y,5,114,50,15)) { set %calc %calc $+ 0 | drawrect -f @calc 15 2 5 20 156 17 | drawrect @calc 2 2 5 20 156 17 | drawtext -oc @calc 2 Tahoma 10 10 22 150 20 $replace(%calc,*,x,/,÷) } 
    if ($inrect($mouse.x,$mouse.y,58,114,50,15)) { set %calc %calc $+ 00 | drawrect -f @calc 15 2 5 20 156 17 | drawrect @calc 2 2 5 20 156 17 | drawtext -oc @calc 2 Tahoma 10 10 22 150 20 $replace(%calc,*,x,/,÷) } 
    if ($inrect($mouse.x,$mouse.y,111,114,50,15)) { set %calc %calc $+ . | drawrect -f @calc 15 2 5 20 156 17 | drawrect @calc 2 2 5 20 156 17 | drawtext -oc @calc 2 Tahoma 10 10 22 150 20 $replace(%calc,*,x,/,÷) } 
    if ($inrect($mouse.x,$mouse.y,169,20,75,15)) { set %calc %calc $+ + | drawrect -f @calc 15 2 5 20 156 17 | drawrect @calc 2 2 5 20 156 17 | drawtext -oc @calc 2 Tahoma 10 10 22 150 20 $replace(%calc,*,x,/,÷) } 
    if ($inrect($mouse.x,$mouse.y,247,20,75,15)) { set %calc %calc $+ - | drawrect -f @calc 15 2 5 20 156 17 | drawrect @calc 2 2 5 20 156 17 | drawtext -oc @calc 2 Tahoma 10 10 22 150 20 $replace(%calc,*,x,/,÷) } 
    if ($inrect($mouse.x,$mouse.y,169,38,75,15)) { set %calc %calc $+ * | drawrect -f @calc 15 2 5 20 156 17 | drawrect @calc 2 2 5 20 156 17 | drawtext -oc @calc 2 Tahoma 10 10 22 150 20 $replace(%calc,*,x,/,÷) } 
    if ($inrect($mouse.x,$mouse.y,247,38,75,15)) { set %calc %calc $+ / | drawrect -f @calc 15 2 5 20 156 17 | drawrect @calc 2 2 5 20 156 17 | drawtext -oc @calc 2 Tahoma 10 10 22 150 20 $replace(%calc,*,x,/,÷) } 
    if ($inrect($mouse.x,$mouse.y,169,56,36,15)) { set %calc %calc $+ ( | drawrect -f @calc 15 2 5 20 156 17 | drawrect @calc 2 2 5 20 156 17 | drawtext -oc @calc 2 Tahoma 10 10 22 150 20 $replace(%calc,*,x,/,÷) } 
    if ($inrect($mouse.x,$mouse.y,208,56,36,15)) { set %calc %calc $+ ) | drawrect -f @calc 15 2 5 20 156 17 | drawrect @calc 2 2 5 20 156 17 | drawtext -oc @calc 2 Tahoma 10 10 22 150 20 $replace(%calc,*,x,/,÷) } 
    if ($inrect($mouse.x,$mouse.y,247,56,75,15)) { set %calc %calc $+ *10/100 | drawrect -f @calc 15 2 5 20 156 17 | drawrect @calc 2 2 5 20 156 17 | drawtext -oc @calc 2 Tahoma 10 10 22 150 20 $replace(%calc,*,x,/,÷) } 
    if ($inrect($mouse.x,$mouse.y,169,74,75,15)) { set %calc2 %calc | set %calc2 $sqrt(%calc2) | drawrect -f @calc 15 2 5 20 156 17 | drawrect @calc 2 2 5 20 156 17 | drawtext -oc @calc 2 Tahoma 10 10 22 150 20 %calc | drawrect -f @calc 15 2 5 40 156 17 | drawrect @calc 2 2 5 40 156 17 | drawtext -oc @calc 2 Tahoma 10 10 42 60 20 %calc2 } 
    if ($inrect($mouse.x,$mouse.y,169,92,76,15)) { set %calc2 %calc | set %calc2 $calc(%calc2) | drawrect -f @calc 15 2 5 40 156 17 | drawrect @calc 2 2 5 40 156 17 | drawtext -oc @calc 2 Tahoma 10 10 42 60 20 %calc2 } 
    if ($inrect($mouse.x,$mouse.y,247,92,76,15)) { drawrect -f @calc 15 2 5 20 156 17 | drawrect @calc 2 2 5 20 156 17 | drawrect -f @calc 15 2 5 40 156 17 | drawrect @calc 2 2 5 40 156 17 | unset %calc | unset %calc2 } 
    if ($inrect($mouse.x,$mouse.y,169,114,153,15)) { window -c @calc } 
  } 
  mouse { 
    if $inrect($mouse.x,$mouse.y,301,3,11,11) { drawdot -f @calc 0 4 308 10 | drawrect @calc 0 1 301 3 11 11 } 
    else { drawrect -f @calc 3 2 301 3 11 11 | drawrect @calc 0 1 301 3 11 11 } 
    if $inrect($mouse.x,$mouse.y,314,3,11,11) { drawdot -f @calc 0 4 321 10 | drawrect @calc 0 1 314 3 11 11 } 
    else { drawrect -f @calc 4 2 314 3 11 11 | drawrect @calc 0 1 314 3 11 11 } 
    if ($inrect($mouse.x,$mouse.y,5,60,50,15)) { drawtext -oc @calc 14 Tahoma 10 27 61 60 20 9 } 
    else { drawtext -oc @calc 2 Tahoma 10 27 61 60 20 9 } 
    if ($inrect($mouse.x,$mouse.y,58,60,50,15)) { drawtext -oc @calc 14 Tahoma 10 80 61 60 20 8 } 
    else { drawtext -oc @calc 2 Tahoma 10 80 61 60 20 8 } 
    if ($inrect($mouse.x,$mouse.y,111,60,50,15)) { drawtext -oc @calc 14 Tahoma 10 133 61 60 20 7 } 
    else { drawtext -oc @calc 2 Tahoma 10 133 61 60 20 7 } 
    if ($inrect($mouse.x,$mouse.y,5,78,50,15)) { drawtext -oc @calc 14 Tahoma 10 27 79 60 20 6 } 
    else { drawtext -oc @calc 2 Tahoma 10 27 79 60 20 6 } 
    if ($inrect($mouse.x,$mouse.y,58,78,50,15)) { drawtext -oc @calc 14 Tahoma 10 80 79 60 20 5 } 
    else { drawtext -oc @calc 2 Tahoma 10 80 79 60 20 5 } 
    if ($inrect($mouse.x,$mouse.y,111,78,50,15)) { drawtext -oc @calc 14 Tahoma 10 133 79 60 20 4 } 
    else { drawtext -oc @calc 2 Tahoma 10 133 79 60 20 4 } 
    if ($inrect($mouse.x,$mouse.y,5,96,50,15)) { drawtext -oc @calc 14 Tahoma 10 27 97 60 20 3 } 
    else { drawtext -oc @calc 2 Tahoma 10 27 97 60 20 3 } 
    if ($inrect($mouse.x,$mouse.y,58,96,50,15)) { drawtext -oc @calc 14 Tahoma 10 80 97 60 20 2 } 
    else { drawtext -oc @calc 2 Tahoma 10 80 97 60 20 2 } 
    if ($inrect($mouse.x,$mouse.y,111,96,50,15)) { drawtext -oc @calc 14 Tahoma 10 133 97 60 20 1 } 
    else { drawtext -oc @calc 2 Tahoma 10 133 97 60 20 1 } 
    if ($inrect($mouse.x,$mouse.y,5,114,50,15)) { drawtext -oc @calc 14 Tahoma 10 27 115 60 20 0 } 
    else { drawtext -oc @calc 2 Tahoma 10 27 115 60 20 0 } 
    if ($inrect($mouse.x,$mouse.y,58,114,50,15)) { drawtext -oc @calc 14 Tahoma 10 77 115 60 20 00 } 
    else { drawtext -oc @calc 2 Tahoma 10 77 115 60 20 00 } 
    if ($inrect($mouse.x,$mouse.y,111,114,50,15)) { drawtext -oc @calc 14 Tahoma 10 135 112 60 20 , } 
    else { drawtext -oc @calc 2 Tahoma 10 135 112 60 20 , } 
    if ($inrect($mouse.x,$mouse.y,169,20,75,15)) { drawtext -oc @calc 14 Tahoma 10 203 21 60 20 + } 
    else { drawtext -oc @calc 2 Tahoma 10 203 21 60 20 + } 
    if ($inrect($mouse.x,$mouse.y,247,20,75,15)) { drawtext -oc @calc 14 Tahoma 10 282 21 60 20 - } 
    else { drawtext -oc @calc 2 Tahoma 10 282 21 60 20 - } 
    if ($inrect($mouse.x,$mouse.y,169,38,75,15)) { drawtext -oc @calc 14 Tahoma 10 204 39 60 20 x } 
    else { drawtext -oc @calc 2 Tahoma 10 204 39 60 20 x } 
    if ($inrect($mouse.x,$mouse.y,247,38,75,15)) { drawtext -oc @calc 14 Tahoma 10 280 39 60 20 ÷ } 
    else { drawtext -oc @calc 2 Tahoma 10 280 39 60 20 ÷ } 
    if ($inrect($mouse.x,$mouse.y,169,56,36,15)) { drawtext -oc @calc 14 Tahoma 9 185 58 60 20 ( } 
    else { drawtext -oc @calc 2 Tahoma 9 185 58 60 20 ( } 
    if ($inrect($mouse.x,$mouse.y,208,56,36,15)) { drawtext -oc @calc 14 Tahoma 9 224 58 60 20 ) } 
    else { drawtext -oc @calc 2 Tahoma 9 224 58 60 20 ) } 
    if ($inrect($mouse.x,$mouse.y,247,56,75,15)) { drawtext -oc @calc 14 Tahoma 10 280 57 60 20 % } 
    else { drawtext -oc @calc 2 Tahoma 10 280 57 60 20 % } 
    if ($inrect($mouse.x,$mouse.y,169,74,75,15)) { drawtext -oc @calc 14 Tahoma 10 185 75 60 20 Au carré } 
    else { drawtext -oc @calc 2 Tahoma 10 185 75 60 20 Au carré } 
    if ($inrect($mouse.x,$mouse.y,247,74,76,15)) { drawtext -oc @calc 14 Tahoma 10 280 75 60 20 Pi } 
    else { drawtext -oc @calc 2 Tahoma 10 280 75 60 20 Pi } 
    if ($inrect($mouse.x,$mouse.y,169,92,76,15)) { drawtext -oc @calc 14 Tahoma 10 202 93 60 20 = } 
    else { drawtext -oc @calc 2 Tahoma 10 202 93 60 20 = } 
    if ($inrect($mouse.x,$mouse.y,247,92,76,15)) { drawtext -oc @calc 14 Tahoma 10 267 93 60 20 Effacer } 
    else { drawtext -oc @calc 2 Tahoma 10 267 93 60 20 Effacer } 
    if ($inrect($mouse.x,$mouse.y,169,114,153,15)) { drawtext -oc @calc 14 Tahoma 10 228 115 60 20 Fermer } 
    else { drawtext -oc @calc 2 Tahoma 10 228 115 60 20 Fermer } 
  } 
  Fermer la fenêtre:window -c @calc 
  Minimiser la fenêtre:window -n @calc 
}

A voir également

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.