1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
#!/usr/bin/python
from Tkinter import *
root = Tk()
texte = StringVar()
frame1=LabelFrame(root,text="Option")
frame1.grid()
def selection():
global hostuse
hostuse= texte.get()
def affiche():
global hostuse
print hostuse
choix1 = Radiobutton(frame1, text='Oui', variable=texte, value='True',command=selection)
choix2 = Radiobutton(frame1, text='Non', variable=texte, value='False',command=selection)
textrad =Label(frame1,text="Utilisez Hosts ? ")
button1 =Button(frame1, text='test', command=affiche)
textrad.grid(row=0,column=0)
choix1.grid(row=0, column=1)
choix2.grid(row=0,column=2)
button1.grid(row=1,column=1)
root.mainloop() |
Partager