So i’m trying to make a program that required you to put in a bunch of data of employees, and the function im using to make these sets of data inputs doesnt return them changing.
Here’s my code :
# Fonction pour créer les employés
def cree_employes(i, n):
# Variables pour les options des employés
typeEmploi = tk.StringVar(fenetre)
lblTypeEmploi = tk.Label(cadreSecondaire)
lblNombreHeures = tk.Label(cadreSecondaire)
lblPourboire = tk.Label(cadreSecondaire)
lblNomEmploye = tk.Label(cadreSecondaire)
options = ["Secretaire", "Comptable", "Superviseur", "Concierge", "Marketeur"]
optTypeEmploi = tk.OptionMenu(cadreSecondaire, typeEmploi, *options)
nb_heures = tk.StringVar(fenetre)
txtNombreHeures = tk.Entry(cadreSecondaire, width=3, textvariable=nb_heures)
nb_pourboire = tk.StringVar(fenetre)
txtPourboire = tk.Entry(cadreSecondaire, width=3, textvariable=nb_pourboire)
nom_employe = tk.StringVar(fenetre)
txtNomEmploye = tk.Entry(cadreSecondaire, width=11, textvariable=nom_employe)
# Label pour le cadre des employés
lblTitreSecondaire = tk.Label(cadreSecondaire)
lblTitreSecondaire["text"] = "Employé " + str(n)
lblTitreSecondaire.configure(font=("Arial", 12), bg="gray15", fg="white")
lblTitreSecondaire.place(anchor=tk.CENTER, relx=.5, rely=.05+2.8*(i/10))
# Configuration et placement des éléments d'entrée pour chaque employé
txtNomEmploye.configure(font=("Arial", 11), bg="gray20", fg="white")
txtNomEmploye.place(anchor=tk.CENTER, relx=.75, rely=.1+2.8*(i/10))
lblNomEmploye["text"] = "Nom d'employé"
lblNomEmploye.configure(font=("Arial", 11), bg="gray15", fg="white")
lblNomEmploye.place(anchor=tk.CENTER, relx=.3, rely=.1+2.8*(i/10))
typeEmploi.set("Secretaire")
optTypeEmploi.configure(fg="white", bg="gray20")
optTypeEmploi.place(anchor=tk.CENTER, relx=.75, rely=.15+2.8*(i/10))
lblTypeEmploi["text"] = "Type d'emploi"
lblTypeEmploi.configure(font=("Arial", 11), bg="gray15", fg="white")
lblTypeEmploi.place(anchor=tk.CENTER, relx=.3, rely=.15+2.8*(i/10))
txtNombreHeures.configure(font=("Arial", 11), bg="gray20", fg="white")
txtNombreHeures.place(anchor=tk.CENTER, relx=.75, rely=.20+2.8*(i/10))
lblNombreHeures["text"] = "Nombres d'heures"
lblNombreHeures.configure(font=("Arial", 11), bg="gray15", fg="white")
lblNombreHeures.place(anchor=tk.CENTER, relx=.3, rely=.20+2.8*(i/10))
txtPourboire.configure(font=("Arial", 11), bg="gray20", fg="white")
txtPourboire.place(anchor=tk.CENTER, relx=.75, rely=.25+2.8*(i/10))
lblPourboire["text"] = "Pourboire"
lblPourboire.configure(font=("Arial", 11), bg="gray15", fg="white")
lblPourboire.place(anchor=tk.CENTER, relx=.3, rely=.25+2.8*(i/10))
widgets = [lblTitreSecondaire, lblTypeEmploi, lblNombreHeures, lblTypeEmploi, lblPourboire, lblNomEmploye, txtNombreHeures, txtPourboire, txtNomEmploye, optTypeEmploi, txtNombreHeures]
Liste = [nom_employe.get(), typeEmploi.get(), nb_heures.get(), nb_pourboire.get()]
return Liste, widgets
So i’ve tried to print multiple texts to see where the problem lies, but it’s just not working. I’ve tested entry widgets on different programs in replit and they work just fine. I’ve also asked this same question three hours ago with my full code but nobody answered so this is my second attempt.Sorry for the code being in french but it’s pretty straightforward. Please help?
Gixo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.