#! /usr/bin/env python # -*- coding: utf-8 -*- # Exemple d'utilisation des boutons radio import tkinter as tk def affiche_choix(): i = v.get() print(i, positions[i-1][0]) root = tk.Tk() v = tk.IntVar() v.set(1) # choix par défaut positions = [("ortho",1),("meta",2),("para",3)] lab = tk.Label(root, text="Choix de la position", fg="dark blue") lab.pack() for txt, val in positions: b = tk.Radiobutton(root, text=txt, padx = 10, variable=v, command=affiche_choix, value=val) b.pack() tk.mainloop()