Salut, Dsl je spam les q°

1)

je comprend pas pourquoi dans ce cas :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
 
from tkinter import * 
fenetre = Tk()
photo =PhotoImage(file='mine.gif')
 
 
for ligne in range(10):
    for colonne in range(10):
        Button(fenetre,image=photo, borderwidth=1).grid(row=ligne, column=colonne)
 
fenetre.mainloop()
Mes bouttons intéragies

Mais dans mon programme principal les bouttons ni ne marche ni me mets l'image :
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
 
from random import*
from tkinter import * 
fenetre = Tk()
def funcs1(L):
    mines(L)
def funcsBoutton(mine,colonne,ligne,x,y,L):
    minesAutours =0
    if mine ==1:
        print("oups")
    else:
        print("piouf")
        for colonnex in range(int((L*L)/3)):
            for ligney in range(int((L*L)/3)):
                if (colonne-1 == x[colonnex]) and (ligne== y[ligney]):
                    minesAutours=minesAutours+1
                if (colonne-1 == x[colonnex]) and (ligne-1== y[ligney]):
                    minesAutours=minesAutours+1
                if (colonne == x[colonnex]) and (ligne-1== y[ligney]):
                    minesAutours=minesAutours+1
                if (colonne-1 == x[colonnex]) and (ligne+1== y[ligney]):
                    minesAutours=minesAutours+1
                if (colonne+1 == x[colonnex]) and (ligne-1== y[ligney]):
                    minesAutours=minesAutours+1
                if (colonne+1 == x[colonnex]) and (ligne+1== y[ligney]):
                    minesAutours=minesAutours+1
                if (colonne+1 == x[colonnex]) and (ligne== y[ligney]):
                    minesAutours=minesAutours+1
                if (colonne == x[colonnex]) and (ligne+1== y[ligney]):
                    minesAutours=minesAutours+1
        print(minesAutours)
 
 
 
def mines(L):
    x= []
    y=[]
    for mines in range(int((L*L)/3)):
        x.append(randrange(L))
        y.append(randrange(L))
    print(x)
    print(y)
    imprime(L,x,y)
 
 
 
 
 
def imprime(L,x,y):
    window = Toplevel(fenetre)
    photo =PhotoImage(file='mine.gif')
    for ligne in range(L):
        for colonne in range(L):
            Button(window,image=photo, borderwidth=1,command=lambda mine =0:funcsBoutton(mine,colonne,ligne,x,y,L)).grid(row=ligne, column=colonne)
            for mines in range(int((L*L)/3)):
                if (colonne ==x[mines]) and (ligne == y[mines]):
                    Button(window,image=photo, borderwidth=1,command=lambda mine =1:funcsBoutton(mine,colonne,ligne,x,y,L)).grid(row=ligne, column=colonne)
 
 
 
def choixDeCasses():
    label = Label(fenetre, text="difficulté :")
    label.pack()
    value = StringVar() 
    bouton1 = Button(fenetre, text="Easy", relief=RAISED, command=lambda x=6:funcs1(x))
    bouton2 = Button(fenetre, text="Normal", relief=RAISED,command=lambda x=10:funcs1(x))
    bouton3 = Button(fenetre, text="Hard", relief=RAISED,command=lambda x=12:funcs1(x))
    bouton1.pack()
    bouton2.pack()
    bouton3.pack()
 
 
choixDeCasses()
fenetre.mainloop()

deplus quand je lance mon programme, il ne calcule pas le bon nombre de "bombe" autours d'une case, et je n'arrive pas à trouver ce qu'il calcule dans
funcsBoutton()

Merci de m'avoir lue, et désolé si je m'exprime mal