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
| from tkinter import *
import math as m
import numpy as np
class eau:
def askwater():
pourcenteau = DoubleVar()
curseureau = Scale(orient='horizontal', from_=0, to=100,
resolution=10, tickinterval=1, length=500,
label='Quel pourcentage d\'eau désirez-vous?', variable=pourcenteau)
curseureau.pack()
validereau=Button(text="Valider", command=curseureau)
validereau.pack()
class programme(eau):
def buildregion(n,p):
interface= Tk()
interface.geometry("1920x1080+0+0")
commencer=Button(interface, text="Commencer", command=askwater)
commencer.pack()
interface.mainloop()
coeff=[0,0,0,[0,0]]
ligne=[p*[coeff]]
region = n*ligne
quantiteau=round((pourcenteau/100)*(n*p))
alea=m.ceil((0.1*eau))
print('alea=',alea)
k=0
while k<alea :
i=np.random.randint(0,p)
j=np.random.randint(0,n)
region[j][i][0]=1
print([i,j])
k+=1
print(region) |
Partager