from Tkinter import * class AllTkinterWidgets: def __init__(self, master): frame = Frame(master, width=500, height=400, bd=1) frame.pack() iframe1 = Frame(frame, bd=2, relief=SUNKEN) Checkbutton(iframe1, text='Choix').pack(side=LEFT, padx=5) v=IntVar() Radiobutton(iframe1, text='Option 1', variable=v, value=3).pack(side=RIGHT, anchor=W) Radiobutton(iframe1, text='Option 2', variable=v, value=2).pack(side=RIGHT, anchor=W) Radiobutton(iframe1, text='Option 3', variable=v, value=1).pack(side=RIGHT, anchor=W) iframe1.pack(expand=1, fill=X, pady=10, padx=5) win = Tk() all = AllTkinterWidgets(win) win.title('Exemple de CheckButton et Bouton radio') win.mainloop() |
Livres Sur ce Sujet
Apprendre à programmer avec Python 3 Apprenez à programmer en Python Python : Petit guide à l’usage du développeur agile Apprendre à programmer avec Python 3 : Avec plus de 50 pages de corigés d’exercices !