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
| def fonction1():
print('fonction1')
def fonction2(arg):
print('fonction2',arg)
entr1.delete (0, len(contenu1))
def fonction3(args):
print('fonction3',args)
entr2.delete (0, len(contenu2))
from tkinter import *
fen1 = Tk()
fen1.title("Titre de ma fenetre")
txt1 = Label(fen1, text ='Grille :')
txt2 = Label(fen1, text ='Numéro :')
entr1 = Entry(fen1)
entr2 = Entry(fen1)
contenu1 = entr1.get()
contenu2 = entr2.get()
can1 = Canvas(fen1, width =160, height =160, bg ='white')
txt1.grid(row =1, sticky =E)
txt2.grid(row =2, sticky =E)
entr1.grid(row =1, column =2)
entr2.grid(row =2, column =2)
bou1 = Button(fen1, text='Effacer', command = fonction1)
bou1.grid(row =3, sticky =E,column =2)
bou2 = Button(fen1, text='Quitter', command = fen1.destroy)
bou2.grid(row =3, sticky =E)
bou3= Button(fen1, text='OK', command=lambda: fonction2(contenu1))
bou3.grid(row =1,column=3)
bou4= Button(fen1, text='OK', command=lambda: fonction3(contenu2))
bou4.grid(row =2,column=3)
fen1.mainloop() |
Partager