def num_bande(x,y,largeur_bandes): if x%20==0: n_bande = x//largeur_bandes else: n_bande = (x+20)//largeur_bandes print (n_bande) num_bande(10,80,20) def largeur_image(lst,largeur_bandes): a = len(lst)*largeur_bandes print(a) def pixels_voisins(x,y): lst =[] lst += [[x,y-1]] lst += [[x,y+1]] lst += [[x-1,y]] lst += [[x+1,y]] print(lst) import graph graph.ouvre_fenetre(240, 240) """lst1 = [1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0]""" lstlst = [[0, 1, 1, 0, 1, 1, 1, 0],[1, 0, 0, 1, 1, 0, 0, 1],[0, 1, 0, 1, 1, 0, 0, 1],[0, 1, 0, 1, 0, 0, 1, 1],[1, 0, 1, 0, 0, 1, 1, 0],[1, 1, 0, 0, 0, 1, 0, 1]] """def dessine_bande1(lst,haut,largeur_bandes): for i in range (len(lst)): if ((lst[i][i]))==0: a=i*largeur_bandes b=i*largeur_bandes+largeur_bandes for z in range(a,b): for f in range(largeur_bandes): graph.plot(f, z)""" def nb_ligne(lst,haut,largeur_bandes): for u in range(6): j=u+20 for i in range (6): for k in range(6): if (lst[i][k])==0: a=k*largeur_bandes b=k*largeur_bandes+largeur_bandes print(a) for z in range(a,b): for f in range(j,j+20): graph.plot(f, z) nb_ligne(lstlst,120,20) print(lstlst[1][0]) graph.attend_fenetre()