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
| def modif_scale_entree(*args, quoi):
if a == 1:
if quoi == 1:
if entree_nb_chiffre.get().isdigit():
curseur_nb_chiffre.set(int(entree_nb_chiffre.get()))
if quoi == 1:
entree_nb_chiffre.insert(0, str(curseur_nb_chiffre.get()))
###########################################################
#frame haut
global frame_haut
frame_haut = Frame(fenetre_jeu, borderwidth = 0, relief = GROOVE, bg="light sky blue")
frame_haut.pack(side = TOP, fill=X)
#bouton retour
global retour_bouton
retour_bouton = Button(frame_haut, bg = 'yellow', fg = 'blue', font = ('Arial', 10), height = 1, width = 5, text = 'Retour')
retour_bouton.pack(side = LEFT)
#frame nb chiffre
frame_nb_chiffre = Frame(frame_haut, bg="light sky blue")
frame_nb_chiffre.pack(side = RIGHT)
#label nombre de chiffre
label_nb_chiffre = Label(frame_nb_chiffre, bg = "light sky blue", fg = 'red', font = ('Arial', 10), text = 'nombre de chiffre')
label_nb_chiffre.grid(row = 0, column = 0, columnspan = 2)
#entree_nb_chiffre
s = StringVar()
s.trace_variable("w", modif_scale_entree(quoi =1))
global entree_nb_chiffre
entree_nb_chiffre = Entry(frame_nb_chiffre, bg = "white", fg = "grey", font = ('Arial', 10), width = 3, textvariable=s)
entree_nb_chiffre.insert(0, '3')
entree_nb_chiffre. grid(row = 1, column = 0)
#curseur nombre chiffre
global curseur_nb_chiffre
curseur_nb_chiffre = Scale(frame_nb_chiffre, orient='horizontal', from_= 0, to=20, resolution= 1, length=80,command = lambda : modif_scale_entree(quoi = 2))
curseur_nb_chiffre.grid(row = 1, column = 1)
#label titre
label_titre = Label(frame_haut, bg = 'red', fg = 'blue', font = ('Arial', 20), text = 'MEMOIRE')
label_titre.pack() |
Partager