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
| def deplacer() :
global a,Zx, Zy, casex, casey, itempion
if X==1 :
casex=[480, 480, 480, 420, 365, 310, 255, 200, 145, 90, 45, 45, 45]
casey=[90, 150, 200, 200, 200, 200, 200, 200, 200, 200, 200, 150, 90]
a=int(de.get()) + a
if a<len(casex) +1 :
Zx=casex[a-1]
Zy=casey[a-1]
pion=PhotoImage(file="rond.gif")
itempion=dessin.create_image(Zx, Zy, image=pion)
else :
monter()
if X==2 :
casex=[460, 400, 340, 280, 220, 160, 160, 160, 100]
casey=[130, 130, 130, 130, 130, 130, 190, 250, 250]
a=int(de.get()) + a
if a<len(casex) +1 :
Zx=casex[a-1]
Zy=casey[a-1]
pion=PhotoImage(file='rond.gif')
itempion=dessin.create_image(Zx, Zy, image=pion)
else :
monter()
if X==3 :
casex=[370, 430, 490, 490, 490, 490, 490]
casey=[310, 310, 310, 250, 190, 130, 70]
a=int(de.get()) + a
if a<len(casex) +1 :
Zx=casex[a-1]
Zy=casey[a-1]
pion=PhotoImage(file='rond.gif')
itempion=dessin.create_image(Zx, Zy, image=pion)
else :
monter ()
dessin.mainloop()
def monter() :
global X,a,item0,item1,item2,item3, boutonI
global boutonQ, boutonD, label_res, boutonMonter, label_resultat
a=0
X=X+1
if X==1 :
dessin.delete(item0)
boutonQ.destroy()
boutonMonter.destroy()
premier=PhotoImage(file="1er.gif")
item1=dessin.create_image(256, 192, image=premier)
boutonD=Button(dessin, text="Lancer le de", command=lancer_le_de)
boutonD.place(x=270, y=260)
label_res=Label(dessin, text='Resultat')
label_res.place(x=280, y=290)
label_resultat=Label(dessin, textvar=de)
label_resultat.place(x=340, y=290)
if X==2 :
dessin.delete(item1)
second=PhotoImage(file="2eme.gif")
item2=dessin.create_image(256, 192, image=second)
if X==3 :
dessin.delete(item2)
troisieme=PhotoImage(file="3eme.gif")
item3=dessin.create_image(256, 192, image=troisieme)
if X==4 :
dessin.delete(item3)
boutonI.destroy()
boutonD.destroy()
label_res.destroy()
label_resultat.destroy()
dernier=PhotoImage(file='dernier.gif')
item4=dessin.create_image(256, 192, image=dernier)
dessin.mainloop() |