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 78 79
| from Tkinter import * # <== Importe Tkinter
fen = Tk() #<== Défini la fenêtre
tex = Label(fen, text="Bienvenue sur notre programme de calculs mentaux", fg="white", bg="black") #tex => définis la variable; Label(fen, text) Affiche le texte; FG=FrontGround; BG=BackGround
tex.pack() #<==Affiche le texte dans une fenetre
tex2 = Label(fen, text="Vous allez avoir le choix entre tout les types de calcul, la difficulté sera croissante au fur et à mesure des calculs", fg="white", bg="black")
tex2.pack()
def window():#<== défini la commande "Window"
fen2 = Tk()
import random
a = random.randint (0,100)
b = random.randint (0,100)
c = a+b
tex = Label(fen2, text="Combien font :", fg="white", bg="black")
tex.pack()
tex2 = Label(fen2, text=a, fg="white", bg="black")
tex2.pack()
tex2 = Label(fen2, text="+", fg="white", bg="black")
tex2.pack()
tex2 = Label(fen2, text=b, fg="white", bg="black")
tex2.pack()
#MODIFIER LA MISE EN PAGE ULTERIEUREMENT
s = Spinbox(fen2, from_=0, to=200)
s.pack()
Bouton7=Button(fen2, text="Proposer", command=test)
Bouton7.pack()
def window2():#<== défini la commande "Window2"
fen3 = Tk()
def window3():#<== défini la commande "Window3"
fen4 = Tk()
def window4():#<== défini la commande "Window4"
fen5 = Tk()
def window5():#<== défini la commande "Window5"
fen6 = Tk()
bouton=Button(fen, text="Les additions", command=window) #<== Créé un bouton permettant de fermer la fenetre
bouton.pack()
bouton2=Button(fen, text="Les soustractions", command=window2)
bouton2.pack()
bouton3=Button(fen, text="Les divisions", command=window3)
bouton3.pack()
bouton4=Button(fen, text="Les multiplications", command=window4)
bouton4.pack()
bouton5=Button(fen, text="Un mélange de tout !", command=window5)
bouton5.pack()
bouton6=Button(fen, text="Quitter le jeu", command=fen.destroy)
bouton6.pack()
fen.mainloop()#<==Ouvre la fenetre |
Partager