Bonjour,

Je suis débutant python, j'utilise tkinter, et ma version est la 2.7.6.
J'ai créé un petit programme pour envoyer des sms sur mobile.
ça marche impeccable, cependant j'ai fait un dictionnaire pour les contacts.
Afin d'ajouter les contacts dans le dico, j'ai fait un genre de formulaire avec entry et des cases à cocher (radiobouton) pour la civilité.
Je n'arrive pas ajouter les radios boutons au reste ?
Je ne comprends pas d'où vient le problème ?
Pouvez-vous m'expliquer quelle erreur j'ai fait ?

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
def ajouter_contact_au_dico():
    filewin = Toplevel(fenetre)
    Label(filewin, text="Civilité").grid(row=1, padx =14, pady =6)
    Label(filewin, text="Nom").grid(row=2, padx =14, pady =6)
    Label(filewin, text="Prénom").grid(row=3, padx =14, pady =6)
    Label(filewin, text="Téléphone").grid(row=4, padx =14, pady =6)
    Label(filewin, text="Identifiant").grid(row=5, padx =14, pady =6)
    Label(filewin, text="Mot de passe").grid(row=6, padx =14, pady =6)
 
    v = IntVar()
    Radiobutton(filewin, text="Mademoiselle", variable=v, value=1).grid(row=1, column =1)
    Radiobutton(filewin, text="Madame", variable=v, value=2).grid(row=1, column =2)
    Radiobutton(filewin, text="Monsieur", variable=v, value=3).grid(row=1, column =3)
    Radiobutton.pack()
    mainloop()
 
    string = StringVar(value='Entrée un nom')
    e2 = Entry(filewin, textvariable=string, width=22)
    e2.grid(row=2, column =1, padx =15, pady =6)
 
    string = StringVar(value='Entrée un prénom')
    e3 = Entry(filewin, textvariable=string, width=22)
    e3.grid(row=3, column =1, padx =15, pady =6)
 
    string = StringVar(value='Entrée un un numéro ')
    e4 = Entry(filewin, textvariable=string, width=22)
    e4.grid(row=4, column =1, padx =15, pady =6)
 
    string = StringVar(value="Entrée l'identifiant")
    e5 = Entry(filewin, textvariable=string, width=22)
    e5.grid(row=5, column =1, padx =15, pady =6)
 
    string = StringVar(value="Entrée le mot de passe")
    e6 = Entry(filewin, textvariable=string, width=22)
    e6.grid(row=6, column =1, padx =15, pady =6)
 
    button = Button(filewin, text="Effacer", command=filewin.quit).grid(row=7, column=0, sticky=W, pady=4)
    button = Button(filewin, text="Valider", command=filewin.quit).grid(row=7, column=1, sticky=W, pady=4)
    button = Button(filewin, text="Fermer", command=filewin.quit).grid(row=7, column=2, sticky=W, pady=4)
    button.pack()
Retour erreur :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
 
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1489, in __call__
    return self.func(*args)
  File "/home/laurent/python/fmsms/test_4.py", line 91, in ajouter
    Radiobutton.pack()
TypeError: unbound method pack_configure() must be called with Radiobutton instance as first argument (got nothing instead)
Merci.