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
|
# -*- coding: utf-8 -*-
from Tkinter import *
def afficher(): # valeur retour
print retour.get()
racine=Tk()
#Frame
cadre0=Frame(racine)
retour=IntVar()
Label(cadre0, text=" 1er").grid(row=0, column=0)
b1=Radiobutton(cadre0, text="xxxxxxxxx", variable=retour, value=1)
b2=Radiobutton(cadre0, text="xxxxxxxxxxx", variable=retour, value=2)
b3=Radiobutton(cadre0, text="xxxxxxxxxxxxx", variable=retour, value=3)
b4=Radiobutton(cadre0, text="xxxxxxxxxxxxxxxx", variable=retour, value=4)
b1.grid(row=0, column=0)
b2.grid(row=1, column=0)
b3.grid(row=2, column=0)
b4.grid(row=3, column=0)
cadre0.pack(side=LEFT)
# création d'un widget 'Canvas' contenant une image gif :
can1 = Canvas(racine, width =160, height =160)
photo = PhotoImage(file ='image.gif')
item = can1.create_image(80,80, image =photo)
can1.pack(side=RIGHT)
bouton=Button(racine, text="Valider", command=afficher).pack(side=BOTTOM,expand=True)
boutonq=Button(racine, text="Quitter",compound="top",command=racine.destroy).pack(side=BOTTOM,expand=True)
racine.mainloop() |
Partager