NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

Signup

import tkinter as tk
from tkinter import ttk, messagebox
import re # Regular expressions for validation
from tkinter import *

from PIL import ImageTk, Image
from tkinter import ttk
import multiprocessing
import functools
from mysql.connector.locales.eng import client_error

import bcrypt
import tkinter as tk
from tkinter import ttk, messagebox
import re
from PIL import ImageTk, Image
import mysql.connector
import uuid
from datetime import datetime
from config import connect





def backButton():
"""
This function is used after hitting back button on page
"""
root.destroy()
from loginPage import loginP
loginP()


def sing_up():
global root

root = tk.Tk()
root['background'] = '#e6f5fc'
width, height = root.winfo_screenwidth(), root.winfo_screenheight()
window_width = int(width * 0.8)
window_height = int(height * 0.8)
root.geometry(f'{width}x{height}')
root.minsize(window_width, window_height)
root.title("Cerepeutics Signup Page")

w2 = Canvas(root, bg='#e0dede', width=int(width), height=int(height*0.09), highlightthickness=0)
w2.place(x=0, y=0)

# Image-LOGO
test = ImageTk.PhotoImage(Image.open("logo-1.png"))
label1 = tk.Label(w2, image=test, borderwidth=0, highlightthickness=0)
label1.place(x=0, y=int(window_height*0.025))

# Image-MainImage
img = ImageTk.PhotoImage(Image.open("char-2.png"))
panel = tk.Label(root, image=img, borderwidth=0, highlightthickness=0)
panel.place(x=int(window_width * 0.10), y=int(window_height * 0.15))

clinic_email = StringVar()
clinic_password= StringVar()
clinic_cnf_password= StringVar()
clinic_name= StringVar()
clinic_language= StringVar()
clinic_location= StringVar()



def validate_email(event=None):
email = clinic_email.get()
pattern = r'^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+.[cC][oO][mM]$'
if email:
if not re.match(pattern, email):
error_label_email.config(text="Please should be have @ and .com", fg="red")
else:
error_label_email.config(text="")
else:
error_label_email.config(text="")
check_form_validity()



def validate_password(event=None):
password = clinic_password.get().strip()

if len(password) == 0:
error_label_password.config(text=" ")
return

if len(password) >= 8 and re.search(r"[A-Z]", password) and re.search(r"[a-z]", password) and re.search(r"d", password) and re.search(r"[!@#$%^&*(),.?":{}|<>]", password):
error_label_password.config(text="")
else:
if len(password) < 8:
error_label_password.config(text="Password must have a minimum of 8 characters.", fg="red")

if not re.search(r"[A-Z]", password):
error_label_password.config(text="Password must contain at least one uppercase letter.", fg="red")

if not re.search(r"[a-z]", password):
error_label_password.config(text="Password must contain at least one lowercase letter.", fg="red")

if not re.search(r"d", password):
error_label_password.config(text="Password must contain at least one numerical digit.", fg="red")

if not re.search(r"[!@#$%^&*(),.?":{}|<>]", password):
error_label_password.config(text="Password must contain at least one special character.", fg="red")

check_form_validity()

def validate_conf_password(event=None):
password = clinic_password.get().strip()
confirm_password = clinic_cnf_password.get().strip()

if len(confirm_password) == 0:
error_label_conf_password.config(text="")
return
if password != confirm_password:
error_label_conf_password.config(text="Password does not match.", fg="red")
root.after(4000, lambda: error_label_conf_password.config(text=""))
else:
error_label_conf_password.config(text="")
check_form_validity()



def check_form_validity():
"""Enable or disable the submit button based on form validity."""
email_valid = not error_label_email.cget("text") and bool(clinic_email.get())
password_valid = not error_label_password.cget("text") and bool(clinic_password.get())
confirm_password_valid = not error_label_conf_password.cget("text") and bool(clinic_cnf_password.get())

if email_valid and password_valid and confirm_password_valid:
submit_button.config(state="normal")
else:
submit_button.config(state="disabled")

def delete_widget():
clinic_name_entry.delete(0, 'end')
clinic_language.set('Select')
clinic_loaction_entry.delete(0, 'end')
clinic_loaction_entry.delete(0, 'end')
clinic_email_entry.set('Select')
clinc_password_entry.set(NONE)
clinc_password_entry.delete(0, 'end')

def submit_form():
clinic_email_get = clinic_email.get()
password = clinic_password.get()
confirm_password = clinic_cnf_password.get()
clinic_name_get = clinic_name.get()
language = clinic_language.get()
location = clinic_location.get()

hashed_password = bcrypt.hashpw(password.encode('utf-8'), bcrypt.gensalt())

if clinic_name_get.strip()!= '':
if language != "Select" and language != '':
if location.strip()!= '':
if clinic_email_get.strip()!= '':
if password.strip()!= '':
if confirm_password.strip()!= '':
try:
cursor, db_connection = connect()
# Insert user data into the database
insert_query = """
INSERT INTO cerepeutics.clinic_registration (clinic_email, clinic_name, clinic_password, clinic_language, clinic_location)
VALUES (%s, %s, %s, %s, %s)
"""
cursor.execute(insert_query, (clinic_email_get, clinic_name_get, hashed_password, language, location))
db_connection.commit()
delete_widget()
messagebox.showinfo("Success", "Signup successful!")
root.destroy()
from loginPage import loginP
loginP()

except mysql.connector.Error as err:
messagebox.showerror("Error", f"Error: {err}")
finally:
if db_connection.is_connected():
cursor.close()
db_connection.close()
else:
l10 = Label(root, text='Confirm Password field cannot be blank', font='comicsanms 12 bold', padx=200,
pady=5, bg='#e6f5fc', fg='#FF0000')
l10.place(x=int(window_width*0.72), y=int(height*0.73))
root.after(4000 , lambda: l10.destroy())
else:
l10 = Label(root, text='Password field cannot be blank', font='comicsanms 12 bold', padx=200,
pady=5, bg='#e6f5fc', fg='#FF0000')
l10.place(x=int(window_width*0.72), y=int(height*0.63))
root.after(4000 , lambda: l10.destroy())
else:
l10 = Label(root, text='Email cannot be blank', font='comicsanms 12 bold', padx=200,
pady=5, bg='#e6f5fc', fg='#FF0000')
l10.place(x=int(window_width*0.72), y=int(height*0.53))
root.after(4000 , lambda: l10.destroy())
else:
l10 = Label(root, text='Location cannot be blank', font='comicsanms 12 bold', padx=200,
pady=5, bg='#e6f5fc', fg='#FF0000')
l10.place(x=int(window_width*0.72), y=int(height*0.43))
root.after(4000 , lambda: l10.destroy())
else:
l10 = Label(root, text='Language cannot be blank', font='comicsanms 12 bold', padx=200,
pady=5, bg='#e6f5fc', fg='#FF0000')
l10.place(x=int(window_width*0.72), y=int(height*0.33))
root.after(4000 , lambda: l10.destroy())
else:
l10 = Label(root, text='Clinic Name must required', font='comicsanms 12 bold', padx=200,
pady=5, bg='#e6f5fc', fg='#FF0000')
l10.place(x=int(window_width*0.72), y=int(height*0.23))
root.after(4000 , lambda: l10.destroy())






style = ttk.Style()
current_theme = style.theme_use()
style.theme_settings(current_theme, {"TNotebook.Tab": {"configure": {"padding": [130, 15]},
"map": {"background": [("selected", 'white')]}}})
style.configure('TNotebook.Tab', font=('URW Gothic L', '11', 'bold'))
style.configure('W.TButton', font=('URW Gothic L', 10, 'bold', 'underline'),
foreground='#3383FF', background="#aecaf5")

heading_label = Label(root, text="Clinic Registration Form",
font=("Times Roman", 30), background='#e6f5fc')
heading_label.place(x=int(window_width*0.70), y=int(height*0.10))





clinic_name_lable= tk.Label(root, text="Clinic Name*:", font=("bold", 13),
background='#e6f5fc')
clinic_name_lable.place(x=int(window_width*0.70), y=int(height*0.20))
clinic_name_entry = Entry(root, textvar=clinic_name, highlightthickness=0, width=36)
clinic_name_entry.place(x=int(window_width*0.90), y=int(height*0.20))


clinic_laguage_lable= tk.Label(root, text="Clinic Language*:", font=("bold", 13),
background='#e6f5fc')
clinic_laguage_lable.place(x=int(window_width*0.70), y=int(height*0.30))
gstatus=["English", "Hindi", "Gujarati"]
clinic_cmobbox= OptionMenu(root, clinic_language, *gstatus)
clinic_cmobbox.config(width=30, background='white', highlightthickness=0)
clinic_language.set('Select')
clinic_cmobbox.place(x=int(window_width*0.90), y=int(height*0.30))


clinic_location_lable= tk.Label(root, text="Clinic Location*:", font=("bold", 13),
background='#e6f5fc')
clinic_location_lable.place(x=int(window_width*0.70), y=int(height*0.40))
clinic_loaction_entry = Entry(root, textvar=clinic_location, highlightthickness=0, width=36)
clinic_loaction_entry.place(x=int(window_width*0.90), y=int(height*0.40))


clinic_email_lable = Label(root, text="Email*:", font=("bold", 13),
background='#e6f5fc')
clinic_email_lable.place(x=int(window_width*0.70), y=int(height*0.50))
clinic_email_entry = Entry(root, textvar=clinic_email, highlightthickness=0, width=36)
clinic_email_entry.place(x=int(window_width*0.90), y=int(height*0.50))
error_label_email = Label(root, text="", font=("Arial", 10), background='#e6f5fc')
error_label_email.place(x=int(window_width*0.90), y=int(height*0.53))
clinic_email_entry.bind("<KeyRelease>", lambda event: validate_email())


clinc_password_lable= tk.Label(root, text="Password*:", font=("bold", 13),
background='#e6f5fc')
clinc_password_lable.place(x=int(window_width*0.70), y=int(height*0.60))
clinc_password_entry = Entry(root, textvar=clinic_password, highlightthickness=0, width=36, show='*')
# clinc_password_entry = Entry(root, textvar=clinic_password, highlightthickness=0, width=36)
clinc_password_entry.place(x=int(window_width*0.90), y=int(height*0.60))
error_label_password = Label(root, text="", font=("Arial", 10), background='#e6f5fc')
error_label_password.place(x=int(window_width*0.90), y=int(height*0.63))
# eye_closed_image = tk.PhotoImage(file='eye_close.png') # Path to your closed eye image
# eye_closed_image = ImageTk.PhotoImage(Image.open("eye_close.png"))

# eye_open_image = ImageTk.PhotoImage(Image.open("eye_open.jfif")) # Path to your open eye image
# eye_icon = tk.Label(clinc_password_entry, image=eye_closed_image, background='#e6f5fc')
# eye_icon.place(x=int(window_width*0.95), y=int(height*0.60))
clinc_password_entry.bind("<KeyRelease>", lambda event: validate_password())
# eye_icon.bind("<Button-1>", lambda event: toggle_password_visibility())

conf_password_lable= tk.Label(root, text="Confirm Password*:", font=("bold", 13),
background='#e6f5fc')
conf_password_lable.place(x=int(window_width*0.70), y=int(height*0.70))
clinc_conf_password_entry = Entry(root, textvar=clinic_cnf_password, highlightthickness=0, width=36, show="*")
clinc_conf_password_entry.place(x=int(window_width*0.90), y=int(height*0.70))
error_label_conf_password = Label(root, text="", font=("Arial", 10), background='#e6f5fc')
error_label_conf_password.place(x=int(window_width*0.90), y=int(height*0.73))
clinc_conf_password_entry.bind("<KeyRelease>", lambda event: validate_conf_password())


# Create a submit button
submit_button = tk.Button(root, text="Submit", command=submit_form, bg='#9BC2F9', width=15)
submit_button.place(x=int(window_width*0.85), y=int(height*0.80))


BackBtn = Button(w2, text='BACK', width=9, bg='#bab8b8', height=1, command=backButton)
BackBtn.place(x=int(width*0.93), y=int(window_height*0.025))

# Run the application
root.mainloop()


if __name__ == '__main__':
multiprocessing.freeze_support()
sing_up()
     
 
what is notes.io
 

Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 14 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.