#!/usr/bin/env python # -*- coding: utf-8 -*- from tkinter import * def factorielle(argu): # calcul de la factorielle de argu a = 1 # a contient une valeur qui va être incrémentée d'une unité à la fois b = 1 # contient la factorielle de a-1 while a <= argu: # on arrêtera lorsque a sera > argu b = b * a a = a + 1 return b def action(): print("Yes, we can !") root=Tk() #w=Label(root, text="Bonjour!") champ = Entry(root) champ.grid(row=0) b = Button(root,text="Click here !",command=root.quit) b.grid(row=1) root.mainloop() # lecture de la valeur du champ texte_n=champ.get() n = int(texte_n) print(n, factorielle(n)) # éliminer la fenêtre : root.destroy()