Groupe fonctionnel de Radiobutton
Salut les pythons,
Je n'arrive pas a créer un groupe fonctionel de Radiobutton car j'arrive a mes fins: exécuter une commande quand on selectionne un des choix, mais j'ai un petit soucis qui est que tous les Radiobutton sont selectionner et je pense que c'est du a ce qu'il ne soit pas regrouper dans un groupe fonctionnel ou ce comportement est-il normal ?:calim2:
Code:
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
|
from Tkinter import *
def test_1() :
global z
z.configure(text='button 1')
def test_2() :
global z
z.configure(text='button 2')
def test_3() :
global z
z.configure(text='button 3')
def test_4() :
global z
z.configure(text='button 4')
a=Tk()
b=Radiobutton(a, text='test 1', command=test_1)
c=Radiobutton(a, text='test 1', command=test_2)
d=Radiobutton(a, text='test 1', command=test_3)
e=Radiobutton(a, text='test 1', command=test_4)
z=Label(a)
z.pack()
b.pack()
c.pack()
d.pack()
e.pack()
a.mainloop() |
On doit normalement utilser un StringVar ou un IntVar pour les regrouper avec l'option variable mais je n'y arrive pas.:calim2:
Sa serai sympa de m'aider a créer un groupe fonctionnel avec les IntVar|StringVar qui ne sont pas mes meilleurs amis.:ccool: