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
|
from Tkinter import *
fenetre = Tk()
fenetre.geometry('400x200+20+500')
famille=('fam1','fam2','fam3')
fam1=('type1-1','type1-2','type1-3')
fam2=('type2-1','type2-2','type2-3')
fam3=('type3-1','type3-2','type3-3')
def choixFamille(choix):
print "choix:", choix
afficherCoupe(choix)
def accueil():
i=0
for choix in famille:
i=i+1
b=Button(fenetre, text=choix
, command=lambda m=choix: choixFamille(m))
b.grid(row=i, column=1)
def afficherCoupe(choix):
b=Button(fenetre, text=choix)
b.grid(row=2, column=1)
for p in range (3):
print(choix[p]) #c'est ici que se situe mon problème (print pour tester
l=Button(fenetre,text=choix[p]) #j'aimerai afficher ici les élements de fam1, 2 ou 3
l.grid(row=p+1, column=2)
accueil()
fenetre.mainloop() |
Partager