我不能在tkinter为其他人打开窗户

2024-04-23 06:52:17 发布

您现在位置:Python中文网/ 问答频道 /正文

Tkinter的GUI应用程序有问题。我不明白为什么我可以打开另一扇窗。 当用户名和密码正常时,connexion窗口将打开其他窗口,但窗口从不显示

我想这是因为我使用了两个tk实例,但是今天早上它的工作非常好

这里是连接窗口的一些代码行

# init the windows
global app
app = Connexion()
app.title("Se connecter")
app.mainloop()

# calling the other windows
Acceuil.appel_affichage_accueil(id_utilisateur)
global app
app.quit()

其他窗口的初始化

def appel_affichage_accueil(IDUtilisateurEnvoye):
    """
        On va afficher un message d'alerte dans la fenetre d'alerte
        la variable afficher correspont auIdUtilisateur message que l'on souhaite faire apparaitre
    """
    global Idutilisateur
    Idutilisateur = IDUtilisateurEnvoye
    AffichageAcceuil()

class AffichageAcceuil(tk.Tk):
    # ligne de code qui se lance lorsque de l'initialisation
    def __init__(self):
        tk.Tk.__init__(self)