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 | ########## Importer les modules necessaires ############## from tkinter import * ########################################################## ########## Fonctions ################################## ########################################################## def aff(): t = Champ.get() Lab.configure(text = 'Bonjour' + t) ########################################################## ########## Variables ################################## ########################################################## ######################################################### ########## Interface graphique ########################## ########################################################## Mafenetre = Tk() Mafenetre.title( "Titre" ) bouton = Button(Mafenetre, text = "Nom ?" , command = aff) bouton.pack(side = RIGHT) Lab = Label(Mafenetre, text = "???" , fg = 'red' , bg = 'white' ) Lab.pack(side = LEFT, padx = 5 , pady = 5 ) Champ = Entry(Mafenetre, bg = 'bisque' , fg = 'maroon' ) Champ.focus_set() Champ.pack(side = LEFT, padx = 5 , pady = 5 ) ########################################################### ########### Receptionnaire d'évènement #################### ########################################################### ###################### FIN ############################### Mafenetre.mainloop() |