Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CTkMessagebox Popup instantly closed after opened #58

Open
1lunea opened this issue Mar 27, 2024 · 0 comments
Open

CTkMessagebox Popup instantly closed after opened #58

1lunea opened this issue Mar 27, 2024 · 0 comments

Comments

@1lunea
Copy link

1lunea commented Mar 27, 2024

So I was replacing tk message box with CTkMessagebox but when I ran the code and tested it, the messagebox instantly closed

        password = self.teachers_password_signup.get()
        confirm = self.teachers_confirm_password_signup.get()
        username = self.teachers_username_signup.get()
        name = self.teachers_name_signup.get()
        if (name or username or confirm or name) == "":
            CTkMessagebox(title="Error", message="Please fill out the form!", icon="OK")
        elif password == confirm:
            with open("data/teachers.txt", "a") as file:
                data = f"{username}:{password}:{name}"
                file.write(data)
                file.write("\n")
            CTkMessagebox(title="Sign Up Successful",message=f"Sign Up successful! Please return to the login site.",icon="check", option_1="OK")
        else:
            CTkMessagebox(title="Error", message="Passwords don't match", icon="OK")
    
    def students_login_event(self):
        password = self.students_password_login.get()
        username = self.students_username_login.get()
        if (username or password) == "":    
            CTkMessagebox(title="Error", message="Please fill out the form!", icon="OK")
        else:
            CTkMessagebox(title="Error", message="Password dont't match", icon="OK")
            with open("data/students.txt","r") as file:
                data = file.readline()
                saved_username ,saved_password, name = data.strip().split(":")
            if saved_username == username and saved_password == password:
                CTkMessagebox(title="Login Successful",message=f"Login successful! Welcome {name} to the app!",icon="check", option_1="OK")
    
    def teachers_login_event(self):
        password = self.teachers_password_login.get()
        username = self.teachers_username_login.get()
        if (username or password) == "":    
            CTkMessagebox(title="Error", message="Please fill out the form!", icon="OK")
        else:
            CTkMessagebox(title="Error", message="Password dont't match", icon="OK")
            with open("data/teachers.txt","r") as file:
                data = file.readline()
                saved_username ,saved_password, name = data.strip().split(":")
            if saved_username == username and saved_password == password:
                CTkMessagebox(title="Login Successful",message=f"Login successful! Welcome {name} to the app!",icon="check", option_1="OK")

    def admins_login_event(self):
        password = self.admins_password_login.get()
        username = self.admins_username_login.get()
        if (username or password) == "":    
            CTkMessagebox(title="Error", message="Please fill out the form!", icon="OK")
        else:
            CTkMessagebox(title="Error", message="Password dont't match", icon="OK")
            with open("data/admins.txt","r") as file:
                data = file.readline()
                saved_username ,saved_password, name = data.strip().split(":")
            if saved_username == username and saved_password == password:
                CTkMessagebox(title="Login Successful",message=f"Login successful! Welcome {name} to the app!",icon="check", option_1="OK")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant