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)
def fonction3(args):
print('fonction3',args)
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)
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 =3)
bou2 = Button(fen1, text='Quitter', command = fen1.destroy)
bou2.grid(row =3, column =0)
bou3= Button(fen1, text='OK', command=lambda: fonction3(entr1))
bou3.grid(row =1,column=3)
bou4= Button(fen1, text='OK', command=lambda: fonction2(entr2))
bou4.grid(row =2,column=3)
fen1.mainloop() |
Partager