如何在python中打开第二个窗口

时间:2019-09-29 15:01:37

标签: python tkinter

我进行了导入,并使用另一个类作为python中的新窗口。成功登录后,单击确定,什么都没有发生,一切都消失了。当我删除代码root.withdraw()时,第二个窗口与第一个窗口一起出现。这是我的python代码

from first import first

def new():
    global newroot
    root.withdraw() #this is the problem. If I remove it, the windows overlap each other
    newroot=first(root)

class Login:
    def cancelLogin(self):
        msg=tkinter.messagebox.askyesno("Login Page","Are you sure you want to cancel Login?");
        if (msg):
            exit()
    def Login(self):
        user=self.userEntry.get()
        passw=self.passEntry.get()
        if user=="" or passw=="":
            tkinter.messagebox.showerror("Error", "Fill all fields")
        elif user=="utoon2" and passw=="majesty4u":
            tkinter.messagebox.showinfo("Login Page","You have successfully logged in");
            root.after(500,new)```

0 个答案:

没有答案