-
Notifications
You must be signed in to change notification settings - Fork 0
/
fct_Calculatrice.py
103 lines (85 loc) · 2.56 KB
/
fct_Calculatrice.py
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
from tkinter import *
from PIL import Image, ImageTk
import winsound
import time
def limite(n,can2,Screen,total): #Limite l'affichage de la calculatrice a 9
if len(total)>9:
total="ERROR" #change l'affichage de la calculatrice car trop de caracteres
clear(n,can2,Screen,total)
total=""
else:
clear(n,can2,Screen,total)
def clear(n,can2,Screen,total): #Supprime l'affichage et le remet avec le nouveau total pour le rafraichir
can2.delete("affichage")
can2.create_text(380,235,font=("arial",50),fill='white',text=total,anchor=E,tag="affichage")
def egal(n,can2,total,Calculatrice_Secret,Screen): #verifie la valeur de total pour savoir si le bon mot de passe est rentre
if total=="63+5":
total=""
can2.itemconfig(Screen,image=Calculatrice_Secret) #mene a l'indice
clear(n,can2,Screen,total)
return(n)
else : #mauvais mots de passe
total="ERROR"
clear(n,can2,Screen,total)
total=""
return(n)
def annuler(n,can2,total,Screen): #vide total
total=""
limite(n,can2,Screen,total)
return(total)
def plus(n,can2,total,Screen): #rajoute "+" au total (pareil pour tout le reste des fonctions)
total=total+"+"
limite(n,can2,Screen,total)
return(total)
def moins(n,can2,total,Screen):
total=total+"-"
limite(n,can2,Screen,total)
return(total)
def multiplier(n,can2,total,Screen):
total=total+"x"
limite(n,can2,Screen,total)
return(total)
def diviser(n,can2,total,Screen):
total=total+"/"
limite(n,can2,Screen,total)
return(total)
def zero(n,can2,total,Screen):
total=total+"0"
limite(n,can2,Screen,total)
return(total)
def un(n,can2,total,Screen):
total=total+"1"
limite(n,can2,Screen,total)
return(total)
def deux(n,can2,total,Screen):
total=total+"2"
limite(n,can2,Screen,total)
return(total)
def trois(n,can2,total,Screen):
total=total+"3"
limite(n,can2,Screen,total)
return(total)
def quatre(n,can2,total,Screen):
total=total+"4"
limite(n,can2,Screen,total)
return(total)
def cinq(n,can2,total,Screen):
total=total+"5"
limite(n,can2,Screen,total)
return(total)
def six(n,can2,total,Screen):
total=total+"6"
limite(n,can2,Screen,total)
return(total)
def sept(n,can2,total,Screen):
total=total+"7"
limite(n,can2,Screen,total)
return(total)
def huit(n,can2,total,Screen):
total=total+"8"
limite(n,can2,Screen,total)
return(total)
def neuf(n,can2,total,Screen):
total=total+"9"
limite(n,can2,Screen,total)
return(total)