Jovian
⭐️
Sign In
In [50]:
from tkinter import *
from tkinter import ttk
import sqlite3 as sq
import tkinter.messagebox
from tkinter.filedialog import askopenfile
from tkinter import ttk
from PIL import Image, ImageTk
from tkcalendar import *
import csv
import tkinter as tk
import ctypes
from itertools import cycle
import time
from time import strftime 

LARGE_FONT= ("Arial", 16)
SMALL_FONT= ("Arial", 12)

class Master(tk.Tk):

    def __init__(self, *args, **kwargs):

        tk.Tk.__init__(self, *args, **kwargs)
        container = tk.Frame(self)
    
        container.pack(side=TOP,fill="both", expand = True)
        container.grid_rowconfigure(0, weight=1)
        container.grid_columnconfigure(0, weight=1)
        
        self.frames = {}

        for F in (StartPage, PageOne, PageTwo, PageThree, PageFour, PageFive, LogIn):

            frame = F(container, self)

            self.frames[F] = frame

            frame.grid(row=0, column=0,sticky=N+S+E+W)
        self.winfo_toplevel().title("By-Mr.Shaktiswarup Pahantasingh")
        self.show_frame(LogIn)
        self.state('zoomed')
    def show_frame(self, cont):

        frame = self.frames[cont]
        frame.tkraise()


class StartPage(tk.Frame):

    def __init__(self, parent, controller):
        tk.Frame.__init__(self,parent)
        tk.Frame.configure(self,bg='lawngreen')
        #tk.Label(self,text="",width=30,height=20,bg="#5CDB95",font=("Vineta BT",20,"bold","italic","underline")).pack(side=TOP)
#         tk.label0=tk.Label(self,text="Student Database Management",width=30,height=2,fg='grey25',bg="lawngreen",font=("Vineta BT",20,"bold","italic","underline"))
#         tk.label0.place(relx=0.2,rely=0.0)
        def time(): 
            string = strftime('%H:%M:%S %p :: %d.%m.%y') 
            lbl.config(text = string) 
            lbl.after(1000, time)  
        lbl = Label(self, font = ('calibri',20, 'bold'), 
                    background = 'lawngreen', 
                    foreground = 'grey2',relief=RIDGE)  
        lbl.place(relx=0.0,rely=0.0) 
        time() 
        b1=tk.Button(self,text="Add Record",command=lambda: controller.show_frame(PageOne) )
        b1.place(relx=0.0,rely=0.2,relwidth=0.2)
        b1.config(cursor='mouse',bg='navy', fg='white', bd=8)
        b2=tk.Button(self,text="View Record",command=lambda: controller.show_frame(PageTwo) )
        b2.place(relx=0.0,rely=0.3,relwidth=0.2)
        b2.config(cursor='mouse',bg='navy', fg='white', bd=8)
        b3=tk.Button(self,text="Delete Record",command=lambda: controller.show_frame(PageThree) )
        b3.place(relx=0.0,rely=0.4,relwidth=0.2)
        b3.config(cursor='mouse',bg='navy', fg='white', bd=8)
        b4=tk.Button(self,text="Update Record",command=lambda: controller.show_frame(PageFour) )
        b4.place(relx=0.0,rely=0.5,relwidth=0.2)
        b4.config(cursor='mouse',bg='navy', fg='white', bd=8)
        b5=tk.Button(self,text="Search Record",command=lambda: controller.show_frame(PageFive) )
        b5.place(relx=0.0,rely=0.6,relwidth=0.2)
        b6=tk.Button(self, text="Log Out", command=lambda: controller.show_frame(LogIn))
        b5.config(cursor='mouse',bg='navy', fg='white', bd=8)
        b6.place(relx=0.0,rely=0.7,relwidth=0.2)
        b6.config(cursor='mouse',bg='navy', fg='white', bd=8)
        self.winfo_toplevel().title("Home Page")
        def imgview(self):
            self.img  = Image.open('home3.png')
            self.img = self.img.resize((1090,707)) 
            photo=ImageTk.PhotoImage(self.img)
            self.lab=Label(self,image=photo,relief=SUNKEN)    
            self.img.image=photo
            self.lab.place(relx=0.2,rely=0.0)
        return imgview(self)
        

class PageOne(tk.Frame):

    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)
        tk.Frame.configure(self,bg='lawngreen')
        label=tk.Label(self,text=" ",bd=12,width=50,height=35,bg="lawngreen",fg="blue",font=("times",12,"bold","italic")).pack()
        
        label0=tk.Label(self,text="Add Student Records Here",fg='grey25',bg="lawngreen",height=1,width=50,)
        label0.place(relx=0.2,rely=0.0)
        label0.config(font=("Vineta BT",12,"bold","italic","underline"))

        e1 = tk.StringVar(self)
        e2 = tk.StringVar(self)
        e3 = tk.IntVar(self,'')
        e4 = tk.IntVar(self,'')
        de1=tk.StringVar(self,'')
        r1 = tk.StringVar(self,'')
        d=tk.StringVar(self)

        self.label1=tk.Label(self,text="Student Name*",width=20)
        self.label1.place(relx=0.1,rely=0.08)
        self.nentry=tk.Entry(self,textvariable=e1,relief=SOLID)
        self.nentry.place(relx=0.5,rely=0.08,relwidth=0.3)
        
        self.lbl2=tk.Label(self,text="DOB*",width=20)
        self.lbl2.place(relx=0.1,rely=0.14)
        self.ent=DateEntry(self,backgroundcolor="blue",foreground="red",borderwidth=15,textvariable=de1,relief=SOLID)
        self.ent.place(relx=0.5,rely=0.14,relwidth=0.3)
        
        self.label2=tk.Label(self,text="Father's Name*",width=20)
        self.label2.place(relx=0.1,rely=0.21)
        self.fentry=tk.Entry(self,textvariable=e2,relief=SOLID)
        self.fentry.place(relx=0.5,rely=0.21,relwidth=0.3)
        
        self.label3=tk.Label(self,text="Contact No.*",width=20)
        self.label3.place(relx=0.1,rely=0.3)
        self.aentry=tk.Entry(self,textvariable=e3,relief=SOLID)
        self.aentry.place(relx=0.5,rely=0.3,relwidth=0.3)
        
        self.label4=tk.Label(self,text="Student ID*",width=20)
        self.label4.place(relx=0.1,rely=0.4)
        self.identry=tk.Entry(self,textvariable=e4,relief=SOLID)
        self.identry.place(relx=0.5,rely=0.4,relwidth=0.3)
        
        self.label4=tk.Label(self,text="Gender*",width=20)
        self.label4.place(relx=0.1,rely=0.5)
        
        self.radiobutton1=tk.Radiobutton(self,text="male",value='male',var=r1).place(relx=0.5,rely=0.5)
        self.radiobutton2=tk.Radiobutton(self,text="Female",value='female',var=r1).place(relx=0.7,rely=0.5)
        
        self.label4=tk.Label(self,text="Country*",width=20)
        self.label4.place(relx=0.1,rely=0.6)
        
        list1 = ['Canada','India','UK','Nepal','Iceland','South Africa'];
        self.droplist=OptionMenu(self,d, *list1)
        self.droplist.config(width=15)
        d.set('select your country') 
        self.droplist.place(relx=0.5,rely=0.6,width=200)
        
        
        self.label5=tk.Label(self,text="Upload Your Photo",width=20)
        self.label5.place(relx=0.1,rely=0.7)
        btn1 = Button(self, text ='import', width=15, command = lambda:OpenFile(self))
        btn1.place(relx=0.5,rely=0.7)
        btn1.config(cursor='mouse',bg='navajoWhite4', fg='white', bd=3)
        def create(self):
            c=len(str(e3.get()))
            print(c)
            if c>10 or c<10:
                 tkinter.messagebox.showerror("Error", "Please Check Your Phn No.")
            else:
                con = sq.connect('studb.db')
                c = con.cursor()
                if e1.get() == "":
                    tkinter.messagebox.showinfo("Warning", "Please Enter Your Name")
                elif e2.get() == "":
                    tkinter.messagebox.showinfo("Warning", "Please Enter Your Fathers Name")
                elif e3.get() == "":
                    tkinter.messagebox.showinfo("Warning", "Please Enter Your Age")
                elif e4.get() == "":
                    tkinter.messagebox.showinfo("Warning", "Please Enter Your Roll Num")
                elif de1.get() =="":
                    tkinter.messagebox.showinfo("Warning", "Please Enter DOB")
                else:
                    try:
                        c.execute('CREATE TABLE IF NOT EXISTS stud1(name TEXT UNIQUE,fname TEXT UNIQUE,age INTEGER,roll INTEGER UNIQUE,gender TEXT,country TEXT,dob DATESTAMP)') 
                        c.execute('INSERT INTO stud1(name,fname,age,roll,gender,country,dob) VALUES(?, ?, ?, ?, ?, ?,?)',[e1.get(),e2.get(),e3.get(),e4.get(),r1.get(),d.get(),de1.get()])
                        result=tkinter.messagebox.askyesno("submit","Do you want to submit ?")
                        if result==True:
                            tkinter.messagebox.showinfo("record  submitted","Your data submitted successfully")
                        else:
                            return print('You press No')
                    except:
                        tkinter.messagebox.showinfo("Please don't repeat your record!", " Already present in the Database")
                con.commit()
        def clearData(self):
            self.nentry.delete(0,END)
            self.fentry.delete(0,END)
            self.aentry.delete(0,END)
            self.identry.delete(0,END)
            self.ent.delete(0,END)
            d.set('Select Your Country')
            
#         def OpenFile(self):
#             global file
#             file = askopenfile(mode ='r', filetypes =[('all type',"*.*")])
#             print(file.name)
        btnSubmit=Button(self,text="Submit",bg="ghost white",font=("Helvetica",9,"bold","italic"),command=lambda:create(self))
        btnSubmit.place(relx=0.2,rely=0.8,relwidth=0.3)
        btnStartPage=Button(self,text="Back",bg="ghost white",font=("Helvetica",9,"bold","italic"),command=lambda:controller.show_frame(StartPage) )
        btnStartPage.place(relx=0.5,rely=0.8,relwidth=0.3)
        btnclearData=Button(self,text="Clear Data ",bg="ghost white",font=("Helvetica",9,"bold","italic"),command=lambda:clearData(self) )
        btnclearData.place(relx=0.2,rely=0.9,relwidth=0.3)
        btnquit=Button(self, text="Log Out", command=lambda: controller.show_frame(LogIn))
        btnquit.place(relx=0.5,rely=0.9,relwidth=0.3)
        btnSubmit.config(cursor='mouse',bg='navy', fg='white', bd=5)
        btnStartPage.config(cursor='mouse',bg='navy', fg='white', bd=5)
        btnclearData.config(cursor='mouse',bg='navy', fg='white', bd=5)
        btnquit.config(cursor='mouse',bg='navy', fg='white', bd=5)
        con = sq.connect('studb.db')
        c = con.cursor()
        con.commit()
        
class PageTwo(tk.Frame):

    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)
        tk.Frame.configure(self,bg='lawngreen')
        label=tk.Label(self,text=" ",bd=12,width=110,height=30,bg="lawngreen",fg="blue",font=("times",12,"bold","italic")).pack()
        label0=tk.Label(self,text="Student Records View Point",fg='grey25',bg="lawngreen",pady=4,width=50,)
        label0.place(relx=0.1,rely=0.0)
        label0.config(font=("Vineta BT",12,"bold","italic","underline"))
        
        def treeview1(self):
            
            con = sq.connect('studb.db')
            c = con.cursor()
            c.execute("SELECT * FROM stud1 ORDER BY roll ASC")
            
            self.tree=ttk.Treeview(self)
            self.tree["columns"]=("e1","e2","e3","e4","r1","d","de1")
            self.tree.column("#0", width=50, stretch=tk.NO)
            self.tree.column("e1", width=100, stretch=tk.NO)
            self.tree.column("e2", width=100,stretch=tk.NO)
            self.tree.column("e3", width=100, stretch=tk.NO)
            self.tree.column("e4", width=60, stretch=tk.NO)
            self.tree.column("r1", width=90, stretch=tk.NO)
            self.tree.column("d", width=95, stretch=tk.NO)
            self.tree.column("de1", width=95, stretch=tk.NO)
            self.tree.heading("#0",text="ID",anchor=tk.W)
            self.tree.heading("e1", text="NAME",anchor=tk.W)
            self.tree.heading("e2", text="FATHER NAME",anchor=tk.W)
            self.tree.heading("e3", text="PH_No",anchor=tk.W)
            self.tree.heading("e4", text="ROLL No.",anchor=tk.W)
            self.tree.heading("r1", text="GENDER",anchor=tk.W)
            self.tree.heading("d", text="COUNTRY",anchor=tk.W)
            self.tree.heading("de1", text="DOB",anchor=tk.W)
            style = ttk.Style(self)
            style.theme_use("clam")
            style.configure("Treeview", fieldbackground="gray")

#             tree = ttk.Treeview(self)
            self.tree.place(relx=0.2,rely=0.1,width=695,height=300)
           
             
            index = id = 1
            for row in c:
                self.tree.insert("", index, text=id, values=row)
                index = id = index + 1
            con.commit()
            #return lambda:treeview1(self)
        btnViewRec=tk.Button(self,text="View All Records",bg="ghost white",font=("Helvetica",9,"bold","italic"),command=lambda:treeview1(self) )
        btnViewRec.place(relx=0.18,rely=0.8,relwidth=0.3)
        btnViewRec.config(cursor='mouse',bg='navy', fg='white', bd=5)
        btnStart=tk.Button(self,text="Back ",bg="ghost white",font=("Helvetica",9,"bold","italic"),command=lambda: controller.show_frame(StartPage) )
        btnStart.place(relx=0.5,rely=0.8,relwidth=0.3)
        btnStart.config(cursor='mouse',bg='navy', fg='white', bd=5)

class PageThree(tk.Frame):

    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)
        tk.Frame.configure(self,bg='lawngreen')
        label=tk.Label(self,text=" ",bd=12,width=50,height=35,bg="lawngreen",fg="blue",font=("times",12,"bold","italic")).pack()
        label0=tk.Label(self,text="Student Records Delete Point",fg='grey25',bg="lawngreen",pady=4,width=50,)
        label0.place(relx=0.1,rely=0.0)
        label0.config(font=("Vineta BT",15,"bold","italic","underline"))
        
        
        labdelete1=Label(self,text='Give a Roll Num* :',font=('none 13 bold'))
        labdelete1.place(relx=0.3,rely=0.5)
        self.rdelete=Entry(self,width=20,font=('none 13 bold'))
        self.rdelete.place(relx=0.3,rely=0.6)
       
        def delete1(self):    
            print("Record Deleted")
            con = sq.connect('studb.db')
            c = con.cursor()
            if self.rdelete.get() == "":
                tkinter.messagebox.showinfo("Warning", "Please Enter a Roll num")
            else:
                
                c.execute("DELETE FROM stud1 WHERE roll = " + self.rdelete.get())
                result1=tkinter.messagebox.askyesno("Delete","Do you want to delete this roll num ?")
                if result1==True:
                    tkinter.messagebox.showinfo("Record Removed","Student record removed successfully")
                con.commit()
                
        btndel1=tk.Button(self,text="Dlete Record",bg="ghost white",font=("Helvetica",9,"bold","italic"),command=lambda:delete1(self) )
        btndel1.place(relx=0.3,rely=0.7,relwidth=0.1)
        btndel1.config(cursor='mouse',bg='navy', fg='white', bd=5)
        btnStart=tk.Button(self,text="Back ",bg="ghost white",font=("Helvetica",9,"bold","italic"),command=lambda: controller.show_frame(StartPage) )
        btnStart.place(relx=0.3,rely=0.8,relwidth=0.2)
        btnStart.config(cursor='mouse',bg='navy', fg='white', bd=5)
        btnView=tk.Button(self,text="View Records ",bg="ghost white",font=("Helvetica",9,"bold","italic"),command=lambda: controller.show_frame(PageTwo) )
        btnView.place(relx=0.5,rely=0.8,relwidth=0.2)
        btnView.config(cursor='mouse',bg='navy', fg='white', bd=5)


        
    

class PageFour(tk.Frame):

    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)
        tk.Frame.configure(self,bg='lawngreen')
        label=tk.Label(self,text=" ",bd=12,width=50,height=35,bg="lawngreen",fg="blue",font=("times",12,"bold","italic")).pack()
        
        label0=tk.Label(self,text="Update Student Records Here",fg='grey25',bg="lawngreen",pady=4,width=50,)
        label0.place(relx=0.1,rely=0.0)
        label0.config(font=("Vineta BT",15,"bold","italic","underline"))
        self.label1=tk.Label(self,text="Enter Roll Num* ",width=20)
        self.label1.place(relx=0.1,rely=0.5)
        self.rsentry=tk.Entry(self)
        self.rsentry.place(relx=0.5,rely=0.5,relwidth=0.3)
        btnupdate=Button(self,text="Select a record",bg="ghost white",font=("Helvetica",9,"bold","italic"),command=lambda:SelectRoll(self))
        btnupdate.place(relx=0.2,rely=0.6,relwidth=0.3)
        btnupdate.config(cursor='mouse',bg='navy', fg='white', bd=5)
        
        record_rol=self.rsentry.get()
        
        labelinfo=tk.Label(self,text="NOTE:Gender,Country,Roll Num can't be Updated*",fg='red',bg="lawngreen",pady=4,width=50,)
        labelinfo.place(relx=0.2,rely=0.7)
        labelinfo.config(font=("Times New Roman",12,"bold","italic"))
        def RecUpdate(self):
            c=len(str(self.aentry.get()))
            print(c)
            if c>10 or c<10:
                 tkinter.messagebox.showerror("Error", "Please Check Your Phn No.")
            else:
                con = sq.connect('studb.db')
                c = con.cursor()
                record_rol=int(self.rsentry.get())
                dataCopy = c.execute("select count(*) from stud1;")
                values = dataCopy.fetchone()
                print (values[0])
                if record_rol >values[0]:
                    tkinter.messagebox.showerror("Error", "No Roll No. Found")

                elif self.rsentry.get() == "":
                    tkinter.messagebox.showinfo("Warning", "Please Enter a Roll num")
                else:
                    c.execute("""UPDATE stud1 SET
                             name=:nm,
                             fname=:fnm,
                             age=:ag,
                             dob=:db
                             WHERE roll=:roll""",
                             {'nm':self.nentry.get(),
                              'fnm':self.fentry.get(),
                              'ag':self.aentry.get(),
                              'db':self.ent.get(),
                              'roll':str(record_rol)
                             })
                    result1=tkinter.messagebox.askyesno("Update","Do you want to update this roll num ?")
                    if result1==True:
                        tkinter.messagebox.showinfo("Record Updated","Student record update successfully")
                    else:
                        return print("you press no")
                    
                    con.commit()
                    con.close()
                    print("Record updated")
        def SelectRoll(self):
            print("Record selected")
            con = sq.connect('studb.db')
            c = con.cursor()
            record_id= int(self.rsentry.get())
            dataCopy = c.execute("select count(*) from stud1;")
            values = dataCopy.fetchone()
            print (values[0])
            if record_id >values[0]:
                 tkinter.messagebox.showerror("Error", "No roll Found")
            if self.rsentry.get() == "":
                tkinter.messagebox.showinfo("Warning", "Please Enter a Roll num")
            else:
                c.execute("SELECT * FROM stud1 WHERE roll = " + str(record_id) )
                records=c.fetchall()
                
                global nentry
                global fentry
                global aentry
                global ent

                self.label1=tk.Label(self,text="Student Name*",width=20)
                self.label1.place(relx=0.1,rely=0.1)
                self.nentry=tk.Entry(self)
                self.nentry.place(relx=0.5,rely=0.1,relwidth=0.3)

                self.label2=tk.Label(self,text="Father's Name*",width=20)
                self.label2.place(relx=0.1,rely=0.2)
                self.fentry=tk.Entry(self)
                self.fentry.place(relx=0.5,rely=0.2,relwidth=0.3)

                self.label3=tk.Label(self,text="Phone No.*",width=20)
                self.label3.place(relx=0.1,rely=0.3)
                self.aentry=tk.Entry(self)
                self.aentry.place(relx=0.5,rely=0.3,relwidth=0.3)

                self.label4=tk.Label(self,text="DOB*",width=20)
                self.label4.place(relx=0.1,rely=0.4)
                self.ent=tk.Entry(self)
                self.ent.place(relx=0.5,rely=0.4,relwidth=0.3)

                for record in records:
                    self.nentry.insert(0,record[0])
                    self.fentry.insert(0,record[1])
                    self.aentry.insert(0,record[2])
                    self.ent.insert(0,record[6])
            def clearData(self):
                self.nentry.delete(0,END)
                self.fentry.delete(0,END)
                self.aentry.delete(0,END)
                self.ent.delete(0,END)
                self.rsentry.delete(0,END)
            btnupdate=Button(self,text="Update Record",bg="ghost white",font=("Helvetica",9,"bold","italic"),command=lambda:RecUpdate(self))
            btnupdate.place(relx=0.5,rely=0.6,relwidth=0.3)
            btnupdate.config(cursor='mouse',bg='navy', fg='white', bd=5)
            btnSubmit=Button(self,text="view all record",bg="ghost white",font=("Helvetica",9,"bold","italic"),command=lambda:controller.show_frame(PageTwo))
            btnSubmit.place(relx=0.2,rely=0.8,relwidth=0.3)
            btnStartPage=Button(self,text="Back ",bg="ghost white",font=("Helvetica",9,"bold","italic"),command=lambda: controller.show_frame(StartPage) )
            btnStartPage.place(relx=0.5,rely=0.8,relwidth=0.3)
            btnclearData=Button(self,text="Clear Data ",bg="ghost white",font=("Helvetica",9,"bold","italic"),command=lambda:clearData(self) )
            btnclearData.place(relx=0.2,rely=0.9,relwidth=0.3)
            btnquit=Button(self, text="Log Out", command=lambda: controller.show_frame(LogIn))
            btnquit.place(relx=0.5,rely=0.9,relwidth=0.3)
            btnSubmit.config(cursor='mouse',bg='navy', fg='white', bd=5)
            btnStartPage.config(cursor='mouse',bg='navy', fg='white', bd=5)
            btnclearData.config(cursor='mouse',bg='navy', fg='white', bd=5)
            btnquit.config(cursor='mouse',bg='navy', fg='white', bd=5)
            con = sq.connect('studb.db')
            c = con.cursor()
            
class PageFive(tk.Frame):

    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)
        tk.Frame.configure(self,bg='lawngreen')
        label=tk.Label(self,text=" ",bd=12,width=50,height=35,bg="lawngreen",fg="blue",font=("times",12,"bold","italic")).pack()
        
        label0=tk.Label(self,text="Search Student Records Here",fg='grey25',bg="lawngreen",pady=4,width=50,)
        label0.place(relx=0.1,rely=0.0)
        label0.config(font=("Vineta BT",15,"bold","italic","underline"))
        self.label1=tk.Label(self,text="Enter Roll Num ",width=20)
        self.label1.place(relx=0.3,rely=0.5)
        self.rsentry=tk.Entry(self)
        self.rsentry.place(relx=0.5,rely=0.5,relwidth=0.3)
        btnupdate=Button(self,text="Show record",bg="ghost white",font=("Helvetica",9,"bold","italic"),command=lambda:SelectRoll1(self))
        btnupdate.place(relx=0.2,rely=0.7,relwidth=0.3)
        btnupdate.config(cursor='mouse',bg='navy', fg='white', bd=5)
    
        def SelectRoll1(self):
            print("Record selected")
            con = sq.connect('studb.db')
            c = con.cursor()
            record_id= int(self.rsentry.get())
            dataCopy = c.execute("select count(*) from stud1;")
            values = dataCopy.fetchone()
            print (values[0])
            if record_id >values[0]:
                 tkinter.messagebox.showerror("Error", "No roll Found")
            elif self.rsentry.get() == "":
                tkinter.messagebox.showinfo("Warning", "Please Enter a Roll num")
            else:
        
                global nentry
                global fentry
                global aentry
                global ent
                global gent
                global cent
            
            
                
                c.execute("SELECT * FROM stud1 WHERE roll = " + str(record_id))
                records=c.fetchall()
                self.label0=tk.Label(self,text="Student Name*",width=20)
                self.label0.place(relx=0.3,rely=0.2)
                self.nentry=tk.Entry(self)
                self.nentry.place(relx=0.5,rely=0.2,relwidth=0.3)



                self.label1=tk.Label(self,text="Father's Name*",width=20)
                self.label1.place(relx=0.3,rely=0.25)
                self.fentry=tk.Entry(self)
                self.fentry.place(relx=0.5,rely=0.25,relwidth=0.3)

                self.label2=tk.Label(self,text="Phone NO.*",width=20)
                self.label2.place(relx=0.3,rely=0.3)
                self.aentry=tk.Entry(self)
                self.aentry.place(relx=0.5,rely=0.3,relwidth=0.3)

                self.label3=tk.Label(self,text="Country*",width=20)
                self.label3.place(relx=0.3,rely=0.35)
                self.cent=tk.Entry(self)
                self.cent.place(relx=0.5,rely=0.35,relwidth=0.3)
                
                self.label4=tk.Label(self,text="DOB*",width=20)
                self.label4.place(relx=0.3,rely=0.4)
                self.ent=tk.Entry(self)
                self.ent.place(relx=0.5,rely=0.4,relwidth=0.3)

                self.label5=tk.Label(self,text="Gender*",width=20)
                self.label5.place(relx=0.3,rely=0.45)
                self.gent=tk.Entry(self)
                self.gent.place(relx=0.5,rely=0.45,relwidth=0.3)

                for record in records:
                    self.nentry.insert(0,record[0])
                    self.fentry.insert(0,record[1])
                    self.aentry.insert(0,record[2])
                    self.ent.insert(0,record[6])
                    self.gent.insert(0,record[4])
                    self.cent.insert(0,record[5])



                con.commit()
                
                
                
                btnSubmit=Button(self,text="view all record",bg="ghost white",font=("Helvetica",9,"bold","italic"),command=lambda:controller.show_frame(PageTwo))
                btnSubmit.place(relx=0.2,rely=0.8,relwidth=0.3)
                btnStartPage=Button(self,text="Back ",bg="ghost white",font=("Helvetica",9,"bold","italic"),command=lambda: controller.show_frame(StartPage) )
                btnStartPage.place(relx=0.5,rely=0.8,relwidth=0.3)
                btnclearData=Button(self,text="Clear Data ",bg="ghost white",font=("Helvetica",9,"bold","italic"),command=lambda:clearData(self) )
                btnclearData.place(relx=0.2,rely=0.9,relwidth=0.3)
                btnquit=Button(self, text="Log Out", command=lambda: controller.show_frame(LogIn))
                btnquit.place(relx=0.5,rely=0.9,relwidth=0.3)
                btnSubmit.config(cursor='mouse',bg='navy', fg='white', bd=5)
                btnStartPage.config(cursor='mouse',bg='navy', fg='white', bd=5)
                btnclearData.config(cursor='mouse',bg='navy', fg='white', bd=5)
                btnquit.config(cursor='mouse',bg='navy', fg='white', bd=5)

                con.commit()
class LogIn(tk.Frame):

    def LogInCheck(self):
        global actEntry
        global pinEntry

        act = "j"
        pin = "py"

        actNum = actEntry.get()
        pinNum = pinEntry.get()

        print("FUNCTION RUN")
        if actNum == act and pinNum == pin:
            print("CORRECT")
            actEntry.delete(0,END)
            pinEntry.delete(0,END)
            self.controller.show_frame(StartPage)
        elif actNum != act or pinNum != pin: 
            print("INCORRECT")
            tkinter.messagebox.showerror("Error","Incorrect Input")
            self.controller.show_frame(LogIn)

    def __init__(self, parent, controller):

        global actEntry
        global pinEntry
        self.controller = controller

        tk.Frame.__init__(self, parent)

        tk.Frame.configure(self,bg='lawngreen')
        label=tk.Label(self,text=" ",bd=12,width=70,height=35,bg="lawngreen",fg="blue",font=("times",12,"bold","italic")).pack()
        def time(): 
            string = strftime('%I:%M:%S %p') 
            lbl.config(text = string) 
            lbl.after(1000, time)  
        lbl = Label(self, font = ('calibri', 60, 'bold'), 
                    background = 'lawngreen', 
                    foreground = 'grey8',relief=RIDGE)  
        lbl.place(relx=0.01,rely=0.1) 
        time() 
        label0=tk.Label(self,text="Please Login Here",fg='grey8',bg="lawngreen",pady=4,width=50)
        label0.place(relx=-0.25,rely=0.25)
        label0.config(font=("Vineta BT",15,"bold","italic","underline"))
        labelinfo=tk.Label(self,text="NOTE:Ask Admin For ID & Password",fg='red',bg="lawngreen",pady=4,width=50,)
        labelinfo.place(relx=0.05,rely=0.3)
        labelinfo.config(font=("Times New Roman",9,"bold","italic"))

        actLabel = Label(self, text = 'Username:',relief=RIDGE)
        actLabel.place(relx=0.05,rely=0.4)
        actEntry = Entry(self,relief=SOLID)
        actEntry.place(relx=0.1,rely=0.4)
        pinLabel = Label(self, text = 'Password:',relief=RIDGE)
        pinLabel.place(relx=0.05,rely=0.45)
        pinEntry = Entry(self, show ="*",relief=SOLID)
        pinEntry.place(relx=0.1,rely=0.45)
        
        
            
        def imgview1(self):
            self.img  = Image.open('userlogin.png')
            self.img2 =  Image.open('shutdown.png')
            self.img3=  Image.open('ppt3.png')
            self.img = self.img.resize((50,20)) 
            self.img2= self.img2.resize((50,20))
            self.img3 = self.img3.resize((910,700))
            photo=ImageTk.PhotoImage(self.img)
            photo1=ImageTk.PhotoImage(self.img2)
            photo3=ImageTk.PhotoImage(self.img3)
            self.lab=Button(self,image=photo,command=self.LogInCheck) 
            self.lab1=Button(self,image=photo1,command = controller.destroy) 
            self.lab2=Label(self,image=photo3,relief=SUNKEN)
            self.img.image=photo
            self.img2.image=photo1
            self.img3.image=photo3
            self.lab.place(relx=0.05,rely=0.6)
            self.lab1.place(relx=0.12,rely=0.6)
            self.lab2.place(relx=0.33,rely=0.0)
            self.lab1.config(cursor='mouse',bg='black', fg='white', bd=15)
            self.lab.config(cursor='mouse',bg='black', fg='white', bd=15)
        return imgview1(self)
        
        
        
if __name__ == "__main__":
     
    app = Master()
    app.mainloop()
    
#===========Questions==============
#add roll 10 data then it is not checking the rest roll data
#country code before phone num
#entry type validation in entries
#event handling
#Date with time
FUNCTION RUN INCORRECT
In [7]:
n=int(input('enter a num:'))
t=1
for i in range(1, n):
    for k in range(n,-1):
        k=k+1
        print('')
    for j in range(i, 0, -1):
        print(j, end=' ')
        
    print('')       
enter a num:5 1 2 1 3 2 1 4 3 2 1
In [23]:
n=int(input("Enter characters: "))

for i in range (1, n+1):

    for j in range(1,i+1):
        print(j, end="")
    for k in range (i-1,0, -1):
        print (k, end='')
    print()
Enter characters: 5 1 121 12321 1234321 123454321
In [ ]:
import jovian
jovian.commit()
[jovian] Saving notebook..
In [6]:
magicnumber = 256
for n in range (500):
    if n is magicnumber:
        print ("the magic number is " , n)
        break
    else:
        print(n)
        break
0
In [ ]: