⇨ MENU ⇨ MODULES ⇨ tkinter ⇨ controles standards ⇨ Spinbox
tkinter.Spinbox ( ).selection_present ( )
⇨ MENU ⇨ MODULES ⇨ tkinter ⇨ controles standards ⇨ Spinbox
tkinter.Spinbox ( ).selection_present ( )
DESCRIPTION.
Test s'il y a une sélection dans la boite à choix.
SYNTAXE.
Valeur = SPI_Choix.selection_present ( )
Valeur = ⇨ variable qui recevra la valeur [ optionnel ]
SPI_Choix ⇨ instance quelconque de tkinter.Spinbox ( ) [ OBLIGATOIRE ]
.selection_present ( ) ⇨ appel de la méthode [ OBLIGATOIRE ]
REMARQUES.
La méthode tkinter.Spinbox ( ).selection_present ( ), ne retournant que l'une des valeurs True ou False, elle est donc particulièrement adaptée pour des expressions à tester avec les instruction if, elif et while, pour controler la présence d'une sélection dans une boite à choix.
EXEMPLE.
import tkinter
def FNC_Choix ( event ) :
SPI_Choix.selection_range ( SCA_Debut.get ( ) , SCA_Fin.get ( ) )
if SPI_Choix.selection_present ( ) : LAB_Selection [ "text" ] = SPI_Choix.selection_get ( )
else : LAB_Selection [ "text" ] = "mauvaises valeurs ..."
TKI_Principal = tkinter.Tk ( )
BUT_Quitter = tkinter.Button ( TKI_Principal , text = "Quitter" , command = TKI_Principal.destroy )
SPI_Choix = tkinter.Spinbox ( TKI_Principal )
SCA_Debut = tkinter.Scale ( TKI_Principal , orient = "horizontal" , label = "De" , to = 68 , command = FNC_Choix )
SCA_Fin = tkinter.Scale ( TKI_Principal , orient = "horizontal" , label = "A" , to = 68 , command = FNC_Choix )
LAB_Selection = tkinter.Label ( TKI_Principal , text = "mauvaises valeurs ..." )
SPI_Choix.pack ( fill = "both" )
SCA_Debut.pack ( fill = "both" )
SCA_Fin.pack ( fill = "both" )
LAB_Selection.pack ( fill = "both" )
BUT_Quitter.pack ( fill = "both" )
SPI_Choix.insert ( 0 , "Python est puissant et facile à apprendre." )
TKI_Principal.mainloop ( )
Votre aide est précieuse pour améliorer ce site, alors n'hésitez pas à faire part de