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
|
import tkinter as tk
nbNote = 0
def saisieNoteUser():
note.set(int(saisieNote.get()) + note.get())
# Création de la fenêtre
fenetre = tk.Tk()
fenetre.title("Test")
# Création d'un label
labelNote = tk.Label(fenetre, text="Note : ")
# Création d'un champ de saisie
saisieNote = tk.Entry(fenetre)
# Création d'un bouton close
boutonClose = tk.Button(fenetre, text="Close", command=fenetre.destroy)
# Création d'un bouton de saisie des notes
boutonSaisie = tk.Button(fenetre, text="Valider", command=saisieNoteUser)
note = tk.IntVar()
# Positionnement des objets
labelNote.grid(row=0, column=0)
saisieNote.grid(row=0, column=1, padx=20)
boutonClose.grid(row=2, column=0)
boutonSaisie.grid(row=2, column=1)
fenetre.mainloop() |
Partager