⇨ MENU ⇨ MODULES ⇨ tkinter ⇨ controles standards ⇨ Radiobutton
tkinter.Radiobutton ( ).select ( )
⇨ MENU ⇨ MODULES ⇨ tkinter ⇨ controles standards ⇨ Radiobutton
tkinter.Radiobutton ( ).select ( )
DESCRIPTION.
Sélectionne, active, le bouton radio appelant.
SYNTAXE.
RAD_Choix.select ( )
RAD_Choix = ⇨ instance quelconque de tkinter.Radiobutton ( ) [ OBLIGATOIRE ]
.select ( ) = appel de la méthode [ OBLIGATOIRE ]
REMARQUES.
Si le bouton appelant est le bouton actif, sélectionné, de son groupe, l'appel de la méthode tkinter.Radiobutton ( ).select ( ) est ignoré.
Si le bouton appelant n'était pas le bouton actif, sélectionné, de son groupe, l'appel de la méthode tkinter.Radiobutton ( ).select ( ) modifiera la valeur de la variable de controle associée à son groupe. Cette nouvelle valeur varie en fonction du type de la variable de controle.
EXEMPLE.
import tkinter
def FNC_Action ( Q ) :
if Q == "Haut" : RAD_Choix1.select ( )
elif Q == "Centre" : RAD_Choix2.select ( )
else : RAD_Choix3.select ( )
TKI_Principal = tkinter.Tk ( )
TKV_Test = tkinter.StringVar ( )
RAD_Choix1 = tkinter.Radiobutton ( TKI_Principal , text = "Haut" , value = "Haut" , variable = TKV_Test )
RAD_Choix2 = tkinter.Radiobutton ( TKI_Principal , text = "Centre" , value = "Centre" , variable = TKV_Test )
RAD_Choix3 = tkinter.Radiobutton ( TKI_Principal , text = "Bas" , value = "Bas" , variable = TKV_Test )
RAD_Choix1.pack ( )
RAD_Choix2.pack ( )
RAD_Choix3.pack ( )
tkinter.Button ( TKI_Principal , text = "Haut" , command = lambda : FNC_Action ( "Haut" ) ).pack ( fill = "both" )
tkinter.Button ( TKI_Principal , text = "Centre" , command = lambda : FNC_Action ( "Centre" ) ).pack ( fill = "both" )
tkinter.Button ( TKI_Principal , text = "Bas" , command = lambda : FNC_Action ( "Bas" ) ).pack ( fill = "both" )
tkinter.Button ( TKI_Principal , text = "Quitter" , command = TKI_Principal.destroy ).pack ( fill = "both" )
TKV_Test.set ( "Centre" )
TKI_Principal.mainloop ( )
Votre aide est précieuse pour améliorer ce site, alors n'hésitez pas à faire part de