Bonjour, je suis en terminale et pour mon projet d'ISN, j'ai décidé de réaliser un genre d'ADVENTURE (le jeu sur Atari 2600).
Mais je rencontre un problème : j'aurai voulu faire que lorsque le cube entre dans la "salle château" (M2) , la couleur des murs de la salle puisse changer tout seul toute les 20ms (voir à 1:28)

mais je n'arrive pas à trouvé comment faire...
Voici la partie de mon code concerné:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
from tkinter import *
 
def Deplacement(event):
    global dx,dy,M
 
    Pos_X,Pos_Y=dx,dy
    Key = event.keysym        #Fonction tkinter pour utiliser les TOUCHES du clavier
 
    if Key == 'Down':
        Pos_Y=dy+1
 
    if Key == 'Up':
        Pos_Y=dy-1
 
    if Key == 'Left':
        Pos_X=dx-1
 
    if Key == 'Right':
        Pos_X=dx+1
 
    if M==M1 and 7<=Pos_X<=11 and Pos_Y==-1 and Key=='Up':
        M=M2
        Pos_X=Pos_X
        Pos_Y=10
 
    if M==M2 and 7<=Pos_X<=11 and Pos_Y==11 and Key=='Down':
        M=M1
        Pos_X=Pos_X
        Pos_Y=0
 
    Verification(Pos_X,Pos_Y)
    Affichage(Pos_X,Pos_Y)
 
def Verification(Pos_X,Pos_Y):
    global dx,dy,M
 
    if M[Pos_X][Pos_Y]==0:
        dx,dy=Pos_X,Pos_Y
 
def Affichage(Pos_X,Pos_Y):
   canvas.delete(ALL)
   global dx,dy,M
   i=0
   j=0
   for j in range(20):
       for i in range(11):
            cube = canvas.create_rectangle(dx*30,dy*30,dx*30+30,dy*30+30,fill = 'white',outline='white')
 
            if M==M1 and M[j][i]==1:
                canvas.create_rectangle(j*30,i*30,j*30+30,i*30+30,fill='#3ADF00',outline='#3ADF00')
 
            if M==M2 and M[j][i]==1:
                canvas.create_rectangle(j*30,i*30,j*30+30,i*30+30,fill='#AEB404',outline='#AEB404')
 
tk = Tk()
tk.title('cube')
 
dx = 9
dy = 5
 
canvas = Canvas(tk, width = 600, height = 330, bg = '#BDBDBD')
canvas.focus_set()
canvas.bind('<Key>',Deplacement)
canvas.pack(padx = 50, pady = 50)
 
Bouton_Quitter = Button(tk, text = 'Quitter', command = tk.destroy)
Bouton_Quitter.pack()
 
M1=[[1,1,1,1,1,1,1,1,1,1,1],
    [1,0,0,0,0,0,0,0,0,0,1],
    [1,0,0,0,0,0,0,0,0,0,1],
    [1,0,0,0,0,0,0,0,0,0,1],
    [1,0,0,0,0,0,0,0,0,0,1],
    [1,0,0,0,0,0,0,0,0,0,1],
    [1,0,0,0,0,0,0,0,0,0,1],
    [1,0,0,0,0,0,0,0,0,0,1],
    [0,0,0,0,0,0,0,0,0,0,1],
    [0,0,0,0,0,0,0,0,0,0,1],
    [0,0,0,0,0,0,0,0,0,0,1],
    [0,0,0,0,0,0,0,0,0,0,1],
    [1,0,0,0,0,0,0,0,0,0,1],
    [1,0,0,0,0,0,0,0,0,0,1],
    [1,0,0,0,0,0,0,0,0,0,1],
    [1,0,0,0,0,0,0,0,0,0,1],
    [1,0,0,0,0,0,0,0,0,0,1],
    [1,0,0,0,0,0,0,0,0,0,1],
    [1,0,0,0,0,0,0,0,0,0,1],
    [1,1,1,1,1,1,1,1,1,1,1]]
 
M2=[[1,1,1,1,1,1,1,1,1,1,1],
    [1,0,0,0,0,0,0,0,0,0,1],
    [1,0,0,0,0,0,0,0,0,0,1],
    [1,0,0,0,0,0,0,0,0,0,1],
    [1,1,1,1,0,0,0,0,0,0,1],
    [0,1,1,1,1,1,1,1,0,0,1],
    [1,1,1,1,1,1,1,1,0,0,1],
    [0,1,1,1,1,1,1,1,0,0,1],
    [1,1,1,1,1,1,1,1,0,0,0],
    [0,0,1,1,1,0,0,0,0,0,0],
    [0,0,1,1,1,0,0,0,0,0,0],
    [1,1,1,1,1,1,1,1,0,0,0],
    [0,1,1,1,1,1,1,1,0,0,1],
    [1,1,1,1,1,1,1,1,0,0,1],
    [0,1,1,1,1,1,1,1,0,0,1],
    [1,1,1,1,0,0,0,0,0,0,1],
    [1,0,0,0,0,0,0,0,0,0,1],
    [1,0,0,0,0,0,0,0,0,0,1],
    [1,0,0,0,0,0,0,0,0,0,1],
    [1,1,1,1,1,1,1,1,1,1,1]]
 
M = M1
 
tk.mainloop()
Et donc c'est la couleur de M2 que je souhaiterai changer. Malheureusement, je n'ai rien trouvé sur le net donc je viens à vous.
Merci de votre réponse.