def save():
     if(XL.getPage() == "ChangeCName"):
         XL.setLastPage("Keyboard")
         new_name = inputbox.get()
         XL.changeCName(new_name,XL.getClass())
         inputbox.delete(0,END)
         controller.show_frame(ChangeCName)
     elif(XL.getPage() == "EditStudents"):
         XL.setLastPage("Keyboard")
         XL.setLstudent(inputbox.get())
         inputbox.delete(0,END)
         controller.show_frame(ScanStudent)
     elif(XL.getPage() == "EditClasses"):
         XL.setLclass(inputbox.get())
         inputbox.delete(0,END)
         controller.show_frame(Number_Pad)
     elif(XL.getPage() == "EditPage"):
         XL.setEmail(inputbox.get())
         inputbox.delete(0,END)
         controller.show_frame(EditPage)
    def __init__(self,parent,controller):
        tk.Frame.__init__(self,parent, bg="orange red")
        v = StringVar()
        v.set(XL.getClass())
        label=tk.Label(self,textvariable=v,font=LARGE_FONT,bg="orange red")
        label.grid(row=1,column=1,sticky=N,padx=20,pady=20)
        #space label for formatting
        space_label = tk.Label(self,text="   ",bg="orange red")
        space_label.grid(row=2,column=0,padx=50)

        button1=tk.Button(self, text="Login",height=4,width=12,padx=4,pady=4,bd=4,
                          command = lambda: controller.show_frame(Login))
        button1.grid(row=2,column=1,padx=50)
        #refresh label
        refresh= tk.Button(self,text="Refresh",relief="raised",padx=4,pady=4,bd=4,
                height=2,width=10,command = lambda: Refresh())
        refresh.grid(row=3,column=1,pady=20)
        def Refresh():
            v.set(XL.getClass())
            label.configure(text=v)
 def __init__(self,parent,controller):
     tk.Frame.__init__(self,parent, bg = "orange red")
     #refresh label
     refresh= tk.Button(self,text="Refresh",relief="raised",padx=4,pady=4,bd=4,
             height=2,width=10,command = lambda: Refresh())
     refresh.grid(row=0,column=2)
     def Refresh():
         clas.set(XL.getClass())
         label2.configure(text=clas)
     #line1
     v = StringVar()
     label=tk.Label(self,textvariable=v,font=LARGE_FONT,bg="orange red")
     label.grid(row=1,column=2,sticky=N)
     v.set("This will change the name")
     #line2
     v2 = StringVar()
     label3=tk.Label(self,textvariable=v2,font=LARGE_FONT,bg="orange red")
     label3.grid(row=2,column=2)
     v2.set("of the current class you are in")
     #where To put the class that is alctually being held 
     clas=StringVar()
     clas.set(XL.getClass())
     label2=tk.Label(self,textvariable=clas,font=LARGE_FONT,bg="orange red")
     label2.grid(row=3,column=2)
     #change class name button
     change=tk.Button(self,text="Rename Class",relief="raised",padx=4,pady=4,bd=4,
             height=2,width=15,command=lambda: go_Keyboard())
     change.grid(row=4,column=2)
     def go_Keyboard():
         XL.setLastPage("ChangeCName")
         controller.show_frame(Keyboard)
     #back button
     Back = tk.Button(self,text="<<Back",relief="raised",padx=4,pady=4,bd=4,
             height=2,width=10,command = lambda: go_Page())
     Back.grid(row=0,column=0)
     def go_Page():
         XL.setLastPage("ChangeCname")
         controller.show_frame(EditPage)
 def Refresh():
     v.set(XL.getClass())
     label.configure(text=v)
 def Refresh():
     clas.set(XL.getClass())
     label2.configure(text=clas)
    def __init__(self,parent,controller):
        tk.Frame.__init__(self,parent, bg = "orange red")
        hasstarted = StringVar()
        hasstarted.set(" ")

        """
        =====================================================================
        Most important function in program. will go line by line on this
        1>> This sets the class start to on so the loop will start and not break
        2-3>Buzz 2 times signals start of class
        4>> this line sets the class start time to that specific lecture sheet
        5>> gets EndOfClass time .. adds start time and class time together
        6>> makes a zero in datetime reference 00:00:00 to use later
        7>> this checks if while(Time left in class > 00:00:00)
        8>> If statement check inside loop if the class is still on
        9>> read in the RFID or wait 5 seconds to loop again
        10> if there is a card read in
        11> format big string into rfid number
        12> places students RFID number and if tardy into the lecture day
        13> 
        14> Buz once to let the user know the card was read in
        15> else the class is no longer on
        16> Set increment day to False so as to let user know the inc
            has not occured yet
        17-19> buz 3 times to let user know class was cancelled
        20> break out of while loop
        21> increment the day of class
        22> set inc to true to let program know the day was incremented
        =====================================================================
        """
        def Start_Class(boo):
            RDC.setison(boo)
            RDC.buz()
            RDC.buz()
            currentT = RDC.getCT()
            XL.setClassS()
            EOC = RDC.getEOC()
            zero = RDC.setT(0,0)
            while((EOC-RDC.getCT())>zero):
                print "time out"
                if(RDC.getison()):
                    print "3"
                    ext = EasyProcess('/home/pi/libnfc/libnfc-1.7.1/examples/nfc-poll').call(timeout=5).stdout
                    print " 4"
                    if(ext):
                        temp = RDC.formatC(ext)
                        if(temp == "d198290f"):
                            break;
                        XL.placeStudent(temp,currentT)
                        #take photo and record him/her
                        RDC.buz()
                        print("student added")
                else:
                    RDC.setinc(False)   
                    break;
            RDC.buz()
            RDC.buz()
            RDC.buz()
            XL.incLectDay()
            day = XL.getLectDay()
            lecture = XL.getLD()
            if(day > lecture):
                showerror(title="Error",message="That was the last day of class.")
            RDC.setinc(True)
        def Upload():
            XL.emailCXL()
            RDC.buz2()
            RDC.buz2()
            RDC.buz2()
            RDC.buz2()
        def Refresh():
            v.set(XL.getClass())
            label3.configure(text=v)
        #start Label
        label2 = tk.Label(self,text="",font=LARGE_FONT,bg="orange red")
        label2.grid(row=0,column=1,padx=100)
        #Start button
        Start= tk.Button(self,text="Start",height=4,width=8,relief="raised",
                         padx=4,pady=4,bd=4,command = lambda: Start_Class(True))
        Start.grid(row=1,column=1)
        v = StringVar()
        v.set(XL.getClass())
        #stop label
        label3 = tk.Label(self,textvariable=v,font=LARGE_FONT,bg="orange red")
        label3.grid(row=2,column=1,padx=100)

        #upload button
        upload= tk.Button(self,text="Upload",height=4,width=8,relief="raised",
                        padx=4,pady=4,bd=4, command = lambda: Upload())
        upload.grid(row=3,column=1)
        
        #edit button
        edit = tk.Button(self,text="Edit",height=4,width=6,
                             relief="raised",padx=4,pady=4,bd=4,
                             command = lambda: controller.show_frame(EditPage))
        edit.grid(row=3,column=2)
        #refresh button
        refresh=tk.Button(self,text="Refresh",relief="raised",padx=4,pady=4,bd=4,
                height=2,width=10,command = lambda: Refresh())
        refresh.grid(row=3,column=0)

        #back button
        Back=tk.Button(self,text="<<Back",relief="raised",padx=4,pady=4,bd=4,
                height=2,width=10,command = lambda:controller.show_frame(Login))
        Back.grid(row=0,column=0)