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
|
my_window= Tk()
Fiche = StringVar()
my_window.geometry('300x300')
my_window.title('Parametres')
Label(my_window, text ="Choisissez une Fiche").grid(row = 0, column = 0)
def install():
global Fiche
Fiche = StringVar()
R1=Radiobutton(my_window, text="Normal", variable=Fiche, value=1, indicatoron=0, command=fiche).grid(row = 1, column = 0)
R2=Radiobutton(my_window, text="Rouge", variable=Fiche, value=2, indicatoron=0, command=fiche).grid(row = 1, column = 1)
my_window.mainloop()
return Fiche
def fiche():
global Fiche
print Fiche.get()
if Fiche.get() == 1:
lb1=Label(my_window, text="valeur1").place(x=10,y=50)
else :
lb1=Label(my_window, text="valeur1").grid_forget()
if Fiche.get() == 2:
lb2=Label(my_window, text="valeur2", bg="red").place(x=10,y=50)
else :
lb2=Label(my_window, text="valeur2").grid_forget()
install() |
Partager