from math import* from tkinter import* from random import* fen=Tk() can1=Canvas(fen,height=1200,width=2000,bg='white') can1.pack() text1=Label(fen,text='1:',fg='blue') text1.place(x=10,y=20) text2=Label(fen,text='2:',fg='blue') text2.place(x=10,y=70) text3=Label(fen,text='3:',fg='blue') text3.place(x=10,y=120) text4=Label(fen,text='4:',fg='blue') text4.place(x=10,y=170) text5=Label(fen,text='5:',fg='blue') text5.place(x=10,y=220) text6=Label(fen,text='6:',fg='blue') text6.place(x=10,y=270) text7=Label(fen,text='Sous total:',fg='orange') text7.place(x=10,y=320) text8=Label(fen,text='Brelan:',fg='dark green') text8.place(x=10,y=370) text9=Label(fen,text='Full:',fg='purple') text9.place(x=10,y=420) text10=Label(fen,text='Petite suite:',fg='goldenrod') text10.place(x=10,y=470) text11=Label(fen,text='Grande suite:',fg='violet red') text11.place(x=10,y=520) text12=Label(fen,text='Carré:',fg='brown') text12.place(x=10,y=570) text13=Label(fen,text='Yams:',fg='cyan4') text13.place(x=10,y=620) text14=Label(fen,text='Chance:',fg='green') text14.place(x=10,y=670) text15=Label(fen,text='Total:',fg='red') text15.place(x=10,y=720) ls1=[] ls2=[] ls3=[] ls4=[] ls5=[] ls6=[] lst=[] lbr=[] lfu=[] lps=[] lgs=[] lc=[] ly=[] lch=[] temp=[] Lstfreebutton=[] LstLb=[] LstCb=[] case0=IntVar() case1=IntVar() case2=IntVar() case3=IntVar() case4=IntVar() CB0=BooleanVar() CB1=BooleanVar() CB2=BooleanVar() CB3=BooleanVar() CB4=BooleanVar() def changeLb(x): pass def clicker(): cpt=compteurfct() lancer(cpt) def lancer(compteur): if compteur==1: for i in range(5): n=randrange(1,7) globals()['case'+str(i)].set(n) LstCb[i].config(state='normal') elif compteur==2: for i in range(5): if globals()['CB'+str(i)].get()==0: Lstfreebutton.append(i) else: LstCb[i].config(state='disabled') for i in range(len(Lstfreebutton)): n=randrange(1,7) globals()['case'+str(Lstfreebutton[i])].set(n) LstCb[Lstfreebutton[i]].config(state='normal') print("Lstfreebutton au 2eme lancé:") for i in range (len(Lstfreebutton)): print(Lstfreebutton[i]," , ",'\n') elif compteur == 3: for i in range(len(Lstfreebutton)): print(i) if (globals()['CB'+str(Lstfreebutton[i])].get()==1): temp.append(Lstfreebutton[i]) LstCb[Lstfreebutton[i]].config(state='disabled') print("Liste temp :") for i in range (len(temp)): print(temp[i]) if (temp[i] in Lstfreebutton): Lstfreebutton.remove(temp[i]) print("Lstfreebutton au 3eme lancé:") for i in range (len(Lstfreebutton)): print(Lstfreebutton[i]," , ") for i in range (len(Lstfreebutton)): n=randrange(1,7) globals()['case'+str(Lstfreebutton[i])].set(n) LstCb[Lstfreebutton[i]].config(state='normal') print("Bouton Libre : ",Lstfreebutton[i]) print("Résultat finaux :") for i in range (5): print(globals()['case'+str(i)].get()) n1=globals()['case0'].get() n2=globals()['case1'].get() n3=globals()['case2'].get() n4=globals()['case3'].get() n5=globals()['case4'].get() liste=[n1,n2,n3,n4,n5] tk.Button(..., text='replay', command=do_replay) #Bt1 def nb1 (): s1=liste.count(1)*1 Btt1.config(text=s1,height='1',width='3',font=('Arial',15,'bold'),state='disabled') Btt2.config(state='disabled') Btt3.config(state='disabled') Btt4.config(state='disabled') Btt5.config(state='disabled') Btt6.config(state='disabled') Bttbr.config(state='disabled') Bttfu.config(state='disabled') Bttgs.config(state='disabled') Bttps.config(state='disabled') Bttc.config(state='disabled') Btty.config(state='disabled') Bttch.config(state='disabled') ls1.append(s1) Btt1=Button(fen,command=nb1) Btt1.config(height='1',width='3',font=('Arial',15,'bold')) Btt1.place(x=82,y=10) #Bt2 def nb2 (): s2=liste.count(2)*2 Btt2.config(text=s2,height='1',width='3',font=('Arial',15,'bold'),state='disabled') Btt1.config(state='disabled') Btt3.config(state='disabled') Btt4.config(state='disabled') Btt5.config(state='disabled') Btt6.config(state='disabled') Bttbr.config(state='disabled') Bttfu.config(state='disabled') Bttgs.config(state='disabled') Bttps.config(state='disabled') Bttc.config(state='disabled') Btty.config(state='disabled') Bttch.config(state='disabled') ls2.append(s2) Btt2=Button(fen,command=nb2) Btt2.config(height='1',width='3',font=('Arial',15,'bold')) Btt2.place(x=82,y=60) #Bt3 def nb3 (): s3=liste.count(3)*3 Btt3.config(text=s3,height='1',width='3',font=('Arial',15,'bold'),state='disabled') Btt2.config(state='disabled') Btt1.config(state='disabled') Btt4.config(state='disabled') Btt5.config(state='disabled') Btt6.config(state='disabled') Bttbr.config(state='disabled') Bttfu.config(state='disabled') Bttgs.config(state='disabled') Bttps.config(state='disabled') Bttc.config(state='disabled') Btty.config(state='disabled') Bttch.config(state='disabled') ls3.append(s3) Btt3=Button(fen,command=nb3) Btt3.config(height='1',width='3',font=('Arial',15,'bold')) Btt3.place(x=82,y=110) #Bt4 def nb4 (): s4=liste.count(4)*4 Btt4.config(text=s4,height='1',width='3',font=('Arial',15,'bold'),state='disabled') Btt2.config(state='disabled') Btt3.config(state='disabled') Btt1.config(state='disabled') Btt5.config(state='disabled') Btt6.config(state='disabled') Bttbr.config(state='disabled') Bttfu.config(state='disabled') Bttgs.config(state='disabled') Bttps.config(state='disabled') Bttc.config(state='disabled') Btty.config(state='disabled') Bttch.config(state='disabled') ls4.append(s4) Btt4=Button(fen,command=nb4) Btt4.config(height='1',width='3',font=('Arial',15,'bold')) Btt4.place(x=82,y=160) #Bt5 def nb5 (): s5=liste.count(5)*5 Btt5.config(text=s5,height='1',width='3',font=('Arial',15,'bold'),state='disabled') Btt2.config(state='disabled') Btt3.config(state='disabled') Btt4.config(state='disabled') Btt1.config(state='disabled') Btt6.config(state='disabled') Bttbr.config(state='disabled') Bttfu.config(state='disabled') Bttgs.config(state='disabled') Bttps.config(state='disabled') Bttc.config(state='disabled') Btty.config(state='disabled') Bttch.config(state='disabled') ls5.append(s5) Btt5=Button(fen,command=nb5) Btt5.config(height='1',width='3',font=('Arial',15,'bold')) Btt5.place(x=82,y=210) #Bt6 def nb6 (): s6=liste.count(6)*6 Btt6.config(text=s6,height='1',width='3',font=('Arial',15,'bold'),state='disabled') Btt2.config(state='disabled') Btt3.config(state='disabled') Btt4.config(state='disabled') Btt5.config(state='disabled') Btt1.config(state='disabled') Bttbr.config(state='disabled') Bttfu.config(state='disabled') Bttgs.config(state='disabled') Bttps.config(state='disabled') Bttc.config(state='disabled') Btty.config(state='disabled') Bttch.config(state='disabled') ls6.append(s6) Btt6=Button(fen,command=nb6) Btt6.config(height='1',width='3',font=('Arial',15,'bold')) Btt6.place(x=82,y=260) #sous total def rst (): st=ls1+ls2+ls3+ls4+ls5+ls6 Bttst.config(text=st,height='1',width='3',font=('Arial',15,'bold'),state='disabled') Btt2.config(state='disabled') Btt3.config(state='disabled') Btt4.config(state='disabled') Btt5.config(state='disabled') Btt6.config(state='disabled') Btt1.config(state='disabled') Bttbr.config(state='disabled') Bttfu.config(state='disabled') Bttgs.config(state='disabled') Bttps.config(state='disabled') Bttc.config(state='disabled') Btty.config(state='disabled') Bttch.config(state='disabled') lst.append(st) Bttst=Button(fen,command=rst) Bttst.config(height='1',width='3',font=('Arial',15,'bold')) Bttst.place(x=82,y=310) #Btbr def cbr (): Br=0 for x in range (7): if liste.count(x)==3: Br=15 Bttbr.config(text=Br,height='1',width='3',font=('Arial',15,'bold'),state='disabled') Btt2.config(state='disabled') Btt3.config(state='disabled') Btt4.config(state='disabled') Btt5.config(state='disabled') Btt6.config(state='disabled') Bttst.config(state='disabled') Btt1.config(state='disabled') Bttfu.config(state='disabled') Bttgs.config(state='disabled') Bttps.config(state='disabled') Bttc.config(state='disabled') Btty.config(state='disabled') Bttch.config(state='disabled') lbr.append(Br) Bttbr=Button(fen,command=cbr) Bttbr.config(height='1',width='3',font=('Arial',15,'bold')) Bttbr.place(x=82,y=360) #Btfu def cfu (): fu=0 for f in range (7): if liste.count(f)==2: for ff in range (7): if liste.count(ff)==3: fu=20 Bttfu.config(text=fu,height='1',width='3',font=('Arial',15,'bold'),state='disabled') Btt2.config(state='disabled') Btt3.config(state='disabled') Btt4.config(state='disabled') Btt5.config(state='disabled') Btt6.config(state='disabled') Bttst.config(state='disabled') Btt1.config(state='disabled') Bttbr.config(state='disabled') Bttgs.config(state='disabled') Bttps.config(state='disabled') Bttc.config(state='disabled') Btty.config(state='disabled') Bttch.config(state='disabled') lfu.append(fu) Bttfu=Button(fen,command=cfu) Bttfu.config(height='1',width='3',font=('Arial',15,'bold')) Bttfu.place(x=82,y=410) #Btps def cps (): ps1=liste.count(1) ps2=liste.count(2) ps3=liste.count(3) ps4=liste.count(4) ps5=liste.count(5) ps=0 if ps1==1: if ps2==1: if ps3==1: if ps4==1: if ps5==1: ps=25 Bttps.config(text=ps,height='1',width='3',font=('Arial',15,'bold'),state='disabled') Btt2.config(state='disabled') Btt3.config(state='disabled') Btt4.config(state='disabled') Btt5.config(state='disabled') Btt6.config(state='disabled') Bttst.config(state='disabled') Bttbr.config(state='disabled') Bttfu.config(state='disabled') Bttgs.config(state='disabled') Btt1.config(state='disabled') Bttc.config(state='disabled') Btty.config(state='disabled') Bttch.config(state='disabled') lps.append(ps) Bttps=Button(fen,command=cps) Bttps.config(height='1',width='3',font=('Arial',15,'bold')) Bttps.place(x=82,y=460) #Btgs def cgs (): gs2=liste.count(2) gs3=liste.count(3) gs4=liste.count(4) gs5=liste.count(5) gs6=liste.count(6) gs=0 if gs2==1: if gs3==1: if gs4==1: if gs5==1: if gs6==1: gs=30 Bttgs.config(text=gs,height='1',width='3',font=('Arial',15,'bold'),state='disabled') Btt2.config(state='disabled') Btt3.config(state='disabled') Btt4.config(state='disabled') Btt5.config(state='disabled') Btt6.config(state='disabled') Bttst.config(state='disabled') Bttbr.config(state='disabled') Bttfu.config(state='disabled') Btt1.config(state='disabled') Bttps.config(state='disabled') Bttc.config(state='disabled') Btty.config(state='disabled') Bttch.config(state='disabled') lgs.append(gs) Bttgs=Button(fen,command=cgs) Bttgs.config(height='1',width='3',font=('Arial',15,'bold')) Bttgs.place(x=82,y=510) #Btc def cc (): c=0 for y in range (7): if liste.count(y)==4: c=40 Bttc.config(text=c,height='1',width='3',font=('Arial',15,'bold'),state='disabled') Btt2.config(state='disabled') Btt3.config(state='disabled') Btt4.config(state='disabled') Btt5.config(state='disabled') Btt6.config(state='disabled') Bttst.config(state='disabled') Bttbr.config(state='disabled') Bttfu.config(state='disabled') Bttgs.config(state='disabled') Bttps.config(state='disabled') Btt1.config(state='disabled') Btty.config(state='disabled') Bttch.config(state='disabled') lc.append(c) Bttc=Button(fen,command=cc) Bttc.config(height='1',width='3',font=('Arial',15,'bold')) Bttc.place(x=82,y=560) #Bty def cy (): y=0 for z in range (7): if liste.count(z)==5: y=50 Btty.config(text=y,height='1',width='3',font=('Arial',15,'bold'),state='disabled') Btt2.config(state='disabled') Btt3.config(state='disabled') Btt4.config(state='disabled') Btt5.config(state='disabled') Btt6.config(state='disabled') Bttst.config(state='disabled') Bttbr.config(state='disabled') Bttfu.config(state='disabled') Bttgs.config(state='disabled') Bttps.config(state='disabled') Bttc.config(state='disabled') Btt1.config(state='disabled') Bttch.config(state='disabled') ly.append(y) Btty=Button(fen,command=cy) Btty.config(height='1',width='3',font=('Arial',15,'bold')) Btty.place(x=82,y=610) #Btch def cch (): Ch=n1+n2+n3+n4+n5 Bttch.config(text=Ch,height='1',width='3',font=('Arial',15,'bold'),state='disabled') Btt2.config(state='disabled') Btt3.config(state='disabled') Btt4.config(state='disabled') Btt5.config(state='disabled') Btt6.config(state='disabled') Bttst.config(state='disabled') Bttbr.config(state='disabled') Bttfu.config(state='disabled') Bttgs.config(state='disabled') Bttps.config(state='disabled') Bttc.config(state='disabled') Btty.config(state='disabled') Btt1.config(state='disabled') lch.append(Ch) Bttch=Button(fen,command=cch) Bttch.config(height='1',width='3',font=('Arial',15,'bold')) Bttch.place(x=82,y=660) #total def rt (): tt=lst+lbr+lfu+lps+lgs+lc+ly+lch Btttt.config(text=tt,height='1',width='3',font=('Arial',15,'bold'),state='disabled') Btttt=Button(fen,command=rt) Btttt.config(height='1',width='3',font=('Arial',15,'bold')) Btttt.place(x=82,y=710) def compteurfct(): global compteur compteur=compteur+1 return compteur #------------------------------------------ compteur = 0 for i in range (5): LstLb.append(Label(fen)) LstLb[i].config(textvariable=globals()['case'+str(i)] ,height='1',width='3',bg='blue',fg='white', font=('Futura Light',40,'bold')) LstLb[i].place(x=110*i+600,y=40) for i in range (5): LstCb.append(Checkbutton(fen,command=lambda x=i:changeLb(x), variable = globals()['CB'+str(i)])) LstCb[i].config(state='disabled') LstCb[i].place(x=110*i+640,y=160) btLancer=Button(fen,command=clicker) btLancer.config(text='Clic pour lancer', font=('Arial',20,'bold')) btLancer.place(x=1200,y=40) btQuit=Button(fen,text='quitter',command=fen.quit) btQuit.place(x=1200,y=600) fen.mainloop() fen.destroy()