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 80 81 82 83 84 85 86 87 88 89 90
| # -*- coding: Latin-1 -*-
#! /usr/bin/python
from Tkinter import *
import random
#################
#Les questions :#
si=" singulier "#
pl=" pluriel " ######################################################################
noms,nomp="Nominatif"+si+"de Aqua,ae = L'eau","Nominatif"+pl+"de Amica,ae = L'amie ?"###
vocs,vocp="Vocatif"+si+"de Ara,ae = L'autel ?","Vocatif"+pl+"de Capra,ae = La chèvre ?"#################
accs,accp="Accusatif"+si+"de Capsa,ae = La boîte ?","Accusatif"+pl+"de Cera,ae = La tablette de cire ?"#
gens,genp="Génitif"+si+"de Charta,ae = La feuille de papier ?","Génitif"+pl+"de Génitif"+pl+"Dea,ae = La déesse ?"###
dats,datp="Datif"+si+"de Domina,ae = La maîtresse ?","Datif"+pl+"de Epistula,ae = La lettre ?"########
abls,ablp="Ablatif"+si+"de Fama,ae = La réputation ?","Ablatif"+pl+"de Fabula,ae = La fille ?"#
###############################################################################################
###############
#Les réponses:##############
rnoms,rnomp="Aqua","Amicae"#
rvocs,rvocp="Ara","Caprae" ##
raccs,raccp="Capsam","Ceras"###
rgens,rgenp="Chartae","Dearum"####
rdats,rdatp="Dominae","Epistulis"#
rabls,rablp="Fama","Fabulis"######
#############################
#############################################
#Toutes les questions réunnit dans une liste#
#############################################
quest=[noms,nomp,vocs,vocp,accs,accp,gens,genp,dats,datp,abls,ablp]
############################################
#Toutes les réponses réunnit dans une liste#
############################################
rep=[rnoms,rnomp,rvocs,rvocp,raccs,raccp,rgens,rgenp,rdats,rdatp,rabls,rablp]
##############
############################
#Organisation pour les nombres aléatoires#
##########################################
deb=0 #"début"
arr=11 #"arrivée"
tout=[] # où l'on stock le nombre aléatoire pour pas qu'il soit répéter
#définition de "e" pour la boucle while
e=0
f=0
rj=1
rf=11
while e!=11:##################
r=random.randint(deb,arr)#
if r not in tout: ##########################################
tout.append(r) #Pour empiler le nombre aléatoire dans la liste#
e=e+1
def repondre() :
if entree.get() == rep[r]:
chaine.configure(text ='Vrai')
elif entree.get() != rep[r]:
chaine.configure(text='Faux ! :( La bonne réponse est :' + rep[r])
#
fen1 = Tk()
fen1.geometry("500x300")
text1 = Label(fen1, text='Cet exercice est sur la 1ère déclinaison' , fg='red')
text1.pack()
text2 = Label(fen1, text='Consigne : Répondez aux questions par un seul mot(celui demander)', fg='red')
text2.pack()
text3 = Label(fen1, text='et ne mettez aucun espace(s) en trop ni de majuscules', fg='red')
text3.pack()
text4 = Label(fen1, text= quest[r] , fg='black')
text4.pack()
entree= Entry(fen1)
chaine = Label(fen1)
entree.pack()
chaine.pack()
Button(fen1, text='valide' ,command = repondre).pack()
Button(fen1, text='Quitter', command = fen1.destroy).pack()
fen1.mainloop() |
Partager