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
| def continuerounon():
global dico_cartes
if len(dico_cartes) != 0:
deplacement()
def deplacement():
global can,titre_paquet,ax,ay,bx,by,cx,cy,dx,dy,x1,x2,y1,y2,xx1,yy1,carte_question,dico_cartes
ax = 1030
ay = 568
bx = 1430
by = 568
cx = 1430
cy = 818
dx = 1030
dy = 818
xx1 = 1230
yy1 = 643
while ax > 530:
if ax%2 == 0:
ax-=1
ay-=1
bx-=1
by-=1
cx-=1
cy-=1
dx-=1
dy-=1
total = ax,ay,bx,by,cx,cy,dx,dy
xx1 -= 1
yy1 -= 1
can.coords(carte_question[0]-1, total)
can.coords(carte_question[0], xx1,yy1)
can.update()
time.sleep(0.00000001)
else:
ax -= 1
bx -= 1
cx -= 1
dx -= 1
xx1 -= 1
total = ax,ay,bx,by,cx,cy,dx,dy
can.coords(carte_question[0]-1, total)
can.coords(carte_question[0], xx1,yy1)
can.update()
time.sleep(0.00000001)
can.update()
can.bind("<Button-1>",retour)
#---------------------------------------------------------------------------------------------------
# Comment retourner une carte ?
#---------------------------------------------------------------------------------------------------
#- - - - - - - - - - - - - - -
# Retournement de la carte
#- - - - - - - - - - - - - - -
def retour(info):
global ax,ay,bx,by,cx,cy,dx,dy,couleur,can,carre,bleu,rouge,vert,texte,coul,noir,retour,tot,carte_question,dico_cartes,vu,croix,carte_texte
print("Je suis à <retour>")
del info
tags = can.find_withtag(carte_question[0])
carte = tags[0]
texte = can.gettags(carte)
texteaffichage = texte[1]
for q,r in dico_cartes.items():
if texteaffichage == q:
textereponse = r
while ax != 930:
for autre in range(3):
if retour != 'o':
can.delete(carte_question[0])
can.delete(texte)
if couleur != coul:
red()
green()
blue()
couleur = '#'+''.join(rouge)+''.join(vert)+''.join(bleu)
texte = can.create_text(730,393, text=texteaffichage, font=("HELVETICA",30), fill = couleur, tags = 'texte')
else:
retour = 'o'
elif ax >= 830 and retour == 'o':
if couleur != noir:
retourred()
retourgreen()
retourblue()
can.delete(texte)
couleur = '#'+''.join(rouge)+''.join(vert)+''.join(bleu)
texte = can.create_text(730,393, text=textereponse, font=("HELVETICA",30), fill = couleur, tags = 'texte')
if ax != 930:
if ax % 10 == 0 and ax < 730:
ay += 1
dy -= 1
by -= 1
cy += 1
if ax % 10 == 0 and ax >= 730:
ay -= 1
dy += 1
by += 1
cy -= 1
cx -= 1
bx -= 1
ax += 1
dx += 1
position = ax,ay,bx,by,cx,cy,dx,dy
can.coords(carte-1,position)
can.update()
time.sleep(0.0001)
carte_texte.append(texte)
can.create_image(570,530, image=vu,tags='vu')
can.create_image(890,530, image=croix,tags='croix')
can.update()
can.bind("<Button-1>",action)
#- - - - - - - - - - - - - - -
# Décision de la personne
#- - - - - - - - - - - - - - -
def juste():
global ax,ay,bx,by,cx,cy,dx,dy,can, carte_question ,xx1,yy1, carte_texte
print("Je suis à <juste>")
can.delete(can.find_withtag("vu"))
can.delete(can.find_withtag("croix"))
print("Carte question 2 = ", carte_question)
carte = carte_question[0]
while ay > -250:
ay -= 1
by -= 1
cy -= 1
dy -= 1
yy1 -= 1
position = ax,ay,bx,by,cx,cy,dx,dy
place = xx1,yy1
can.coords(carte-1,position)
can.coords(carte_texte[0],place)
can.update()
time.sleep(0.000001)
carte_question.remove(carte_question[0])
carte_texte.remove(carte_texte[0])
print(carte_texte)
can.after(500,continuerounon())
def faux():
global ax,ay,bx,by,cx,cy,dx,dy,can, carte_question ,xx1,yy1, carte_texte
print("Je suis à <faux>")
can.delete(can.find_withtag("vu"))
can.delete(can.find_withtag("croix"))
print("Carte question 2 = ", carte_question)
carte = carte_question[0]
while ay < 1500:
ay += 1
by += 1
cy += 1
dy += 1
yy1 += 1
position = ax,ay,bx,by,cx,cy,dx,dy
place = xx1,yy1
can.coords(carte-1,position)
can.coords(carte_texte[0],place)
can.update()
time.sleep(0.000001)
carte_question.remove(carte_question[0])
carte_texte.remove(carte_texte[0])
print(carte_texte)
can.after(500,continuerounon())
def action(event):
global can
print("Je suis à <action>")
boutonSel = can.find_closest(event.x, event.y)
if len(boutonSel) != 0:
boutonID = boutonSel[0]
nom = can.gettags(boutonID)
if nom[0] == "retour":
del event
creation_accueil()
elif nom[0] == "automat":
del event
crea_auto()
elif nom[0] == "manuel":
del event
crea_manu()
elif nom[0] == "poubelle":
del event
supprimer()
elif nom[0] == "revision":
del event
revision_commencement()
elif nom[0] == "vu":
del event
juste()
elif nom[0] == "croix":
del event
faux() |
Partager