zoneTexte = function() {
	require(tcltk)
	# Création de la boite de dialogue (nommée formu)
	formu = tktoplevel()
	tktitle(formu) = "Calcul du carre d'un nombre"
	# fonction associée au bouton OK
	executer = function() {
		nombre = as.numeric( tkget(zone_nombre) ) 
		carre = nombre * nombre
		reponse = paste("le carre de", nombre, "vaut", carre)
		# affichage dans la console R
		print( reponse )
		# affichage dans une boite de message
		tkmessageBox(message=reponse)
	}
	# fonction associée au bouton quitter
	quitter = function() {
		tkdestroy(formu)
	}
	# creation des composants : label_nombre, zone_nombre, bouton_ok et bouton_quitter
	label_nombre = tklabel(formu, text="nombre : ")
	zone_nombre = tkentry(formu)
	bouton_ok = tkbutton(formu, text="OK", command=executer)
	bouton_quitter = tkbutton(formu, text="Quitter", command=quitter)
	# positionnement des composants sur 2 lignes
	tkgrid(label_nombre, zone_nombre)
	tkgrid(bouton_ok, bouton_quitter)
	# affichage de la fenetre
	tkfocus(formu)
}


zoneListe = function(tab) {
	require(tcltk)
	# Création de la boite de dialogue (nommée formu)
	formu = tktoplevel()
	tktitle(formu) = "Creation d'un rapport"
	# fonction associée au bouton OK
	executer = function() {
		# recuperation des valeurs 
		variable = tclvalue( tkget(zone_variable,tkcurselection(zone_variable)) )
		legende = as.character( tkget(zone_legende) )
		# affichage du resume 
		resume = summary(tab[[variable]])
		print(resume)
		# graphique : boite à moustaches ou camembert
		if (is.numeric(tab[[variable]])) {
			boxplot(tab[[variable]], main=legende)
		} else {
			pie(table(tab[[variable]]), main=legende)
		}
	}
	# fonction associée au bouton quitter
	quitter = function() {
		tkdestroy(formu)
	}
	# creation des composants : label_variable, zone_variable, label_legende...
	label_variable = tklabel(formu, text="variable : ")
	zone_variable = tklistbox(formu, height=length(names(tab)), exportselection=0)
	for (element in names(tab)) {
		tkinsert(zone_variable,"end",element)
	}
	label_legende = tklabel(formu, text="legende : ")
	zone_legende = tkentry(formu)
	bouton_ok = tkbutton(formu, text="OK", command=executer)
	bouton_quitter = tkbutton(formu, text="Quitter", command=quitter)
	# positionnement des composants sur 3 lignes
	tkgrid(label_variable, zone_variable)
	tkgrid(label_legende, zone_legende)
	tkgrid(bouton_ok, bouton_quitter)
	# affichage de la fenetre
	tkfocus(formu)
}


