⇨ MENU ⇨ MODULES ⇨ tkinter ⇨ liste des méthodes
tkinter.wait_window ( )
⇨ MENU ⇨ MODULES ⇨ tkinter ⇨ liste des méthodes
tkinter.wait_window ( )
DESCRIPTION.
Attends qu'une fenêtre ou qu'une boite de dialogue soit fermée ou détruite.
SYNTAXE.
widget.wait_window ( fenetre )
widget ⇨ controle quelconque de l'interface [ OBLIGATOIRE ]
.wait_window ( ) ⇨ appel de la méthode [ OBLIGATOIRE ]
fenetre ⇨ identification de la fenêtre à surveiller [ OBLIGATOIRE ]
REMARQUES.
fenetre ⇨ doit être un identifiant, une variable ou un chemin indiquant la fenêtre à surveiller.
La méthode tkinter.wait_window ( ) permet principalement d'attendre que l'utilisateur est finit d'entrer son choix dans une boite de dialogue, pour utiliser cette saisie dans la suite de l'application.
EXEMPLE.
import tkinter
def FNC_Chrono ( ) :
LAB_Chrono [ "text" ] = int ( LAB_Chrono [ "text" ] ) + 1
TKI_Principal.after ( 100 , FNC_Chrono )
def FNC_Fermer ( ) :
TKI_Principal.wait_window ( TKI_Second )
kduree = int ( LAB_Chrono [ "text" ] ) / 10
LAB_Info [ "text" ] = "Mission réussie."
LAB_Chrono [ "text" ] = f"{kduree:.2f} s. avant fermeture."
TKI_Principal = tkinter.Tk ( )
TKI_Principal.geometry ( "+400+200" )
BUT_Quitter = tkinter.Button ( TKI_Principal , text = "Quitter" , command = TKI_Principal.destroy )
LAB_Info = tkinter.Label ( TKI_Principal , text = "Fermer l'autre fenêtre" )
LAB_Chrono = tkinter.Label ( TKI_Principal , text = "0" )
LAB_Info.pack ( )
LAB_Chrono.pack ( )
BUT_Quitter.pack ( )
TKI_Second = tkinter.Toplevel ( )
TKI_Second.geometry ( "+430+340" )
tkinter.Label ( TKI_Second , text = "Fermez cette\nfenetre ..." ).pack ( )
tkinter.Button ( TKI_Second , text = "Fermer" , command = TKI_Second.destroy ).pack ( )
FNC_Chrono ( )
FNC_Fermer ( )
TKI_Principal.mainloop ( )
Votre aide est précieuse pour améliorer ce site, alors n'hésitez pas à faire part de