1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| class HMA(object):
def __init__(self):
self.pays = ['France', 'Allemagne', 'Italie', 'Suisse', 'Uk']
self.root = Tk()
for i in range(0, len(self.pays)):
# Button(self.root, text=self.pays[i], command=self.pays[i]).grid(row=0, column=i, pady=10, padx=10)
Button(self.root, text=self.pays[i], command = lambda index = i : self.choix_pays(index)).grid(row=0, column=i, pady=10, padx=10)
def choix_pays(self, index):
if index == 0:
self.France()
if index == 1:
self.Allemagne()
def France(self):
# self.lb1.configure(text="Serveur France")
print("France")
def Allemagne(self):
# self.lb1.configure(text="Serveur Allemagne")
print("Allemagne") |
Partager