Функция, созданная для нескольких страниц в одном окне tkinter, не работает - PullRequest
0 голосов
/ 19 апреля 2020

Я пишу кусок кода для моего уровня A, где будет окно tkinter, которое использует кнопки для перехода на несколько страниц. Страницы имеют свои собственные функции, которые управляют отдельными SQL базами данных. Когда я запускаю программу, написанные страницы появляются поверх друг друга, но все еще сохраняют свою функциональность. Любая помощь будет принята с благодарностью.

Вот интерфейс

import tkinter as tk
from tkinter import* 
import tkinter.messagebox
import NEA_SQL_IIII

class Page(tk.Frame):
    def __init__(self, *args, **kwargs):
        tk.Frame.__init__(self, *args, **kwargs)
    def show(self):
        self.lift()

class Page1(Page):
   def __init__(self, root, *args, **kwargs):
       Page.__init__(self, *args, **kwargs)
       self.root =root

#These are all the entry widgets, where the values will be added
       StudentID = tk.StringVar()
       StudentName = tk.StringVar()
       Behaviour = tk.IntVar()
       Achievement = tk.IntVar()
       Detention = tk.IntVar()
       ProgressLevels = tk.IntVar()



        #This is the section that will give the buttons their functionality
       def Exit():
           Exit = tk.messagebox.askyesno("ODIN","Do you wish to exit?")
           if Exit > 0:
               root.destroy()
               return
       def Clear():
           self.entStudentID.delete(0,END)
           self.entStudentName.delete(0,END)
           self.entBehaviour.delete(0,END)
           self.entAchievement.delete(0,END)
           self.entDetention.delete(0,END)
           self.entProgressLevels.delete(0,END)

       def addData():
           if(len(StudentName.get())!=0):
               NEA_SQL_III.addStudent(StudentID.get(), StudentName.get(), Behaviour.get(), Achievement.get(), Detention.get(), ProgressLevels.get())
               studentList.delete(0,END)
               studentList.insert(END,(StudentID.get(), StudentName.get(), Behaviour.get(), Achievement.get(), Detention.get(), ProgressLevels.get())), 



       def viewData():
           studentList.delete(0,END)
           for row in NEA_SQL_IIII.display():
               studentList.insert(END,row,str(""))

       def StudentRec(event):
           global sd
           searchStudent = studentList.curselection()[0]
           sd = studentList.get(searchStudent)

           self.entStudentID.delete(0,END)
           self.entStudentID.insert(END,sd[0])
           self.entStudentName.delete(0,END)
           self.entStudentName.insert(END,sd[1])
           self.entBehaviour.delete(0,END)
           self.entBehaviour.insert(END,sd[2])
           self.entAchievement.delete(0,END)
           self.entAchievement.insert(END,sd[3])
           self.entDetention.delete(0,END)
           self.entDetention.insert(END,sd[4])
           self.entProgressLevels.delete(0,END)
           self.entProgressLevels.insert(END,sd[5])

       def deleteData():
           if(len(StudentName.get())!=0):
               NEA_SQL_IIII.DeleteData(sd[0])
               Clear()
               viewData()

       def searchDatabase():
           studentList.delete(0,END)
           for row in NEA_SQL_IIII.search(StudentID.get(), StudentName.get(), Behaviour.get(), Achievement.get(), Detention.get(), ProgressLevels.get()):
               studentList.insert(END,row,str(""))

       def Update():
           if(len(StudentID.get())!=0):
               NEA_SQL_IIII.DeleteData(sd[0])
           if(len(StudentID.get())!=0):
               NEA_SQL_IIII.addStudent(StudentID.get(),StudentName.get(),Behaviour.get(),Achievement.get(),Detention.get(),ProgressLevels.get())
               studentList.delete(0,END)
               studentList.insert(END,(StudentID.get(),StudentName.get(),Behaviour.get(),Achievement.get(),Detention.get(),ProgressLevels.get()))


        #These will define all the different frames
       MainFrame = tk.Frame(bg="Ghost White")
       MainFrame.pack(side="top", fill="both", expand=True)

       TitFrame = tk.Frame(MainFrame, bd=2, padx=54, pady=8, bg="Ghost White", relief = RIDGE)
       TitFrame.pack(side=TOP)

       self.lblTit = tk.Label(TitFrame ,font=('ariel', 47,'bold'),text="Welcome to the ODIN main page",bg="Ghost White")
       self.lblTit.pack()

       ButtonFrame = tk.Frame(MainFrame, bd=2, width=1350, height=70, padx=18, pady=10, bg="blue2", relief = RIDGE)
       ButtonFrame.pack(side=BOTTOM)



       DataFrame = tk.Frame(MainFrame, bd=1, width=1300, height=400, padx=20, pady=20, bg="ghost white", relief = RIDGE)
       DataFrame.pack(side=BOTTOM)



       DataFrameLEFT = tk.LabelFrame(DataFrame, bd=1, width=450, height=200, padx=20,pady=3, bg="Ghost White", relief = RIDGE, font=('ariel', 20,'bold'), text = "Student Info\n")
       DataFrameLEFT.pack(side=LEFT)

       DataFrameRIGHT = tk.LabelFrame(DataFrame, bd=1, width=450, height=200, padx=31,pady=3, bg="Ghost White", relief = RIDGE, font=('ariel', 20,'bold'), text = "Student Details\n")
       DataFrameRIGHT.pack(side=RIGHT)

        #These are the widgets that will allow for labels onto the entry sections



       self.lblStudentID = tk.Label(DataFrameLEFT ,font=('ariel', 11,'bold'),text="Student ID", padx=2, pady=2, bg="Ghost White")
       self.lblStudentID.grid(row=0, column=0)#, sticky=w)
       self.entStudentID = tk.Entry(DataFrameLEFT ,font=('ariel', 11,'bold'),textvariable=StudentID,  width=39)
       self.entStudentID.grid(row=0, column=1)

       self.lblStudentName = tk.Label(DataFrameLEFT ,font=('ariel', 11,'bold'),text="Student Name", padx=2, pady=2, bg="Ghost White")
       self.lblStudentName.grid(row=1, column=0)#, sticky=W)
       self.entStudentName = tk.Entry(DataFrameLEFT ,font=('ariel', 11,'bold'),textvariable=StudentName,  width=39)
       self.entStudentName.grid(row=1, column=1)

       self.lblBehaviour = tk.Label(DataFrameLEFT ,font=('ariel', 11,'bold'),text="Behaviour", padx=2, pady=2, bg="Ghost White")
       self.lblBehaviour.grid(row=2, column=0)#, sticky=W)
       self.entBehaviour = tk.Entry(DataFrameLEFT ,font=('ariel', 11,'bold'),textvariable=Behaviour,  width=39)
       self.entBehaviour.grid(row=2, column=1)

       self.lblAchievement = tk.Label(DataFrameLEFT ,font=('ariel', 11,'bold'),text="Achievement", padx=2, pady=2, bg="Ghost White")
       self.lblAchievement.grid(row=3, column=0)#, sticky=W)
       self.entAchievement = tk.Entry(DataFrameLEFT ,font=('ariel', 11,'bold'),textvariable=Achievement,  width=39)
       self.entAchievement.grid(row=3, column=1)

       self.lblDetention= tk.Label(DataFrameLEFT ,font=('ariel', 11,'bold'),text="Detention", padx=2, pady=2, bg="Ghost White")
       self.lblDetention.grid(row=4, column=0)#, sticky=W)
       self.entDetention = tk.Entry(DataFrameLEFT ,font=('ariel', 11,'bold'),textvariable=Detention,  width=39)
       self.entDetention.grid(row=4, column=1)

       self.lblProgressLevels= tk.Label(DataFrameLEFT ,font=('ariel', 11,'bold'),text="ProgressLevels", padx=2, pady=2, bg="Ghost White")
       self.lblProgressLevels.grid(row=5, column=0)#, sticky=W)
       self.entProgressLevels = tk.Entry(DataFrameLEFT ,font=('ariel', 11,'bold'),textvariable=ProgressLevels,  width=39)
       self.entProgressLevels.grid(row=5, column=1)



#This defines the scrollbar

       scrollbar = tk.Scrollbar(DataFrameRIGHT)
       scrollbar.grid(row=0, column=1)#, sticky = 'ns')

       studentList = Listbox(DataFrameRIGHT, width=41, height=16, font=('ariel',12,'bold'), yscrollcommand=scrollbar.set)
       studentList.bind('<<ListboxSelect>>',StudentRec)
       studentList.grid(row=0, column=0, padx=8)
       scrollbar.config(command = studentList.yview)
#This defines the buttons
        #self.btnAddDate = Button(ButtonFrame, text='Add New', font=('ariel',20,'bold'),height=1,width=10, bd=4, command=addData)
        #self.btnAddDate.grid(row=0, column=0)

       self.btnDisplay = Button(ButtonFrame, text='Display', font=('ariel',20,'bold'),height=1,width=10, bd=4, command=viewData)
       self.btnDisplay.grid(row=0, column=0)

       self.btnClear = Button(ButtonFrame, text='Clear', font=('ariel',20,'bold'),height=1,width=10, bd=4, command=Clear)
       self.btnClear.grid(row=0, column=1)

       self.btnDelete = Button(ButtonFrame, text='Delete', font=('ariel',20,'bold'),height=1,width=10, bd=4, command = deleteData)
       self.btnDelete.grid(row=0, column=2)

       self.btnSearch = Button(ButtonFrame, text='Search', font=('ariel',20,'bold'),height=1,width=10, bd=4, command = searchDatabase)
       self.btnSearch.grid(row=0, column=3)



       self.btnUpdate = Button(ButtonFrame, text='Update', font=('ariel',20,'bold'),height=1,width=10, bd=4, command = Update)
       self.btnUpdate.grid(row=0, column=4)

       self.btnQuit = Button(ButtonFrame, text='Quit', font=('ariel',20,'bold'),height=1,width=10, bd=4, command=Exit)
       self.btnQuit.grid(row=0, column=5)




class Page2(Page):
   def __init__(self, root, *args, **kwargs):
       Page.__init__(self, *args, **kwargs)
       self.root =root
       Absent = BooleanVar()
       AbsenceNote = BooleanVar()
       TotalAbsences = IntVar()
       StudentName = StringVar()
       StudentID = StringVar()
       should_auto = BooleanVar()


       def Clear():
           self.entStudentID.delete(0,END)
           self.entStudentName.delete(0,END)
           self.chkAbsent.deselect()
           self.chkAbsenceNote.deselect()
           self.entTotalAbsences.delete(0,END)


       def Exit():
           Exit = tk.messagebox.askyesno("ODIN","Do you wish to exit?")
           if Exit > 0:
               root.destroy()
               return

       def searchDatabase():
           attendanceList.delete(0,END)
           for row in NEA_SQL_IIII.searchA(StudentID.get(),StudentName.get()):
               attendanceList.insert(END,row,str(""))


       def viewData():
           attendanceList.delete(0,END)
           for row in NEA_SQL_IIII.displayA():
               attendanceList.insert(END,row,str(""))

       def deleteData():
           if(len(StudentName.get())!=0):
              NEA_SQL_IIII.DeleteDataA(sd[0])
              Clear()
              viewData()

       def AttendRec(event):
           global sd
           searchAttend = attendanceList.curselection()[0]
           sd = attendanceList.get(searchAttend)

           self.entStudentID.delete(0,END)
           self.entStudentID.insert(END,sd[0])
           self.entStudentName.delete(0,END)
           self.entStudentName.insert(END,sd[1])
           self.chkAbsent.deselect()
           self.chkAbsent.select()
           self.chkAbsenceNote.deselect()
           self.chkAbsenceNote.select()
           self.entTotalAbsences.delete(0,END)
           self.entTotalAbsences.insert(END,sd[4])

       def Update():
           if(len(StudentID.get())!=0):
               NEA_SQL_IIII.DeleteDataA(sd[0])
           if(len(StudentID.get())!=0):
               NEA_SQL_IIII.addStudentA(StudentID.get(),StudentName.get(),Absent.get(),AbsenceNote.get(),TotalAbsences.get())
               attendanceList.delete(0,END)
               attendanceList.insert(END,(StudentID.get(),StudentName.get(),Absent.get(),AbsenceNote.get(),TotalAbsences.get()))




       MainFrameA = Frame(bg="Ghost White")
       MainFrameA.pack(side="top", fill="both", expand=True)

       TitFrameA = Frame(MainFrameA, bd=2, padx=54, pady=8, bg="Ghost White", relief = RIDGE)
       TitFrameA.pack(side=TOP)

       self.lblTit = Label(TitFrameA ,font=('ariel', 47,'bold'),text="ODIN Attendance Page",bg="Ghost White")
       self.lblTit.pack()

       ButtonFrameA = Frame(MainFrameA, bd=2, width=1350, height=70, padx=18, pady=10, bg="blue2", relief = RIDGE)
       ButtonFrameA.pack(side=BOTTOM)

       DataFrameA = Frame(MainFrameA, bd=1, width=1300, height=400, padx=20, pady=20, bg="ghost white", relief = RIDGE)
       DataFrameA.pack(side=BOTTOM)

        #DataFrameTOP = LabelFrame(DataFrame, bd=1, width=1000, height=300, padx=20, pady=4, relief = RIDGE,  bg="Ghost White", font=('ariel', 20,'bold'), text = "Student Info\n")
        #DataFrameTOP.pack(side=TOP)

       DataFrameALEFT = LabelFrame(DataFrameA, bd=1, width=450, height=200, padx=20,pady=3, bg="Ghost White", relief = RIDGE, font=('ariel', 20,'bold'), text = "Student Info\n")
       DataFrameALEFT.pack(side=LEFT)

       DataFrameARIGHT = LabelFrame(DataFrameA, bd=1, width=450, height=200, padx=31,pady=3, bg="Ghost White", relief = RIDGE, font=('ariel', 20,'bold'), text = "Student Details\n")
       DataFrameARIGHT.pack(side=RIGHT)




       self.lblStudentID = Label(DataFrameALEFT ,font=('ariel', 11,'bold'),text="Student ID", padx=2, pady=2, bg="Ghost White")
       self.lblStudentID.grid(row=0, column=0)#, sticky=W)
       self.entStudentID = Entry(DataFrameALEFT ,font=('ariel', 11,'bold'),textvariable=StudentID,  width=39)
       self.entStudentID.grid(row=0, column=1)

       self.lblStudentName = Label(DataFrameALEFT ,font=('ariel', 11,'bold'),text="Student Name", padx=2, pady=2, bg="Ghost White")
       self.lblStudentName.grid(row=1, column=0)#, sticky=W)
       self.entStudentName = Entry(DataFrameALEFT ,font=('ariel', 11,'bold'),textvariable=StudentName,  width=39)
       self.entStudentName.grid(row=1, column=1)

       self.lblAbsent = Label(DataFrameALEFT ,font=('ariel', 11,'bold'),text="Absent?", padx=2, pady=2, bg="Ghost White")
       self.lblAbsent.grid(row=2, column=0)#, sticky=W)
       self.chkAbsent = Checkbutton(DataFrameALEFT ,font=('ariel', 11,'bold'),textvariable=Absent, variable = should_auto, onvalue = True, offvalue = False, width=39)
       self.chkAbsent.grid(row=2, column=1)

       self.lblAbsenceNote = Label(DataFrameALEFT ,font=('ariel', 11,'bold'),text="Absence Note?", padx=2, pady=2, bg="Ghost White")
       self.lblAbsenceNote.grid(row=3, column=0)#, sticky=W)
       self.chkAbsenceNote = Checkbutton(DataFrameALEFT ,font=('ariel', 11,'bold'),textvariable=AbsenceNote,  width=39, onvalue = True, offvalue = False)
       self.chkAbsenceNote.grid(row=3, column=1)

       self.lblTotalAbsences = Label(DataFrameALEFT ,font=('ariel', 11,'bold'),text="Total Absences?", padx=2, pady=2, bg="Ghost White")
       self.lblTotalAbsences.grid(row=4, column=0)#, sticky=W)
       self.entTotalAbsences = Entry(DataFrameALEFT ,font=('ariel', 11,'bold'),textvariable=TotalAbsences,  width=39)
       self.entTotalAbsences.grid(row=4, column=1)





       scrollbarA = Scrollbar(DataFrameARIGHT)
       scrollbarA.grid(row=0, column=1, sticky = 'ns')

       attendanceList = Listbox(DataFrameARIGHT, width=41, height=16, font=('ariel',12,'bold'), yscrollcommand=scrollbarA.set)
       attendanceList.bind('<<ListboxSelect>>',AttendRec)
       attendanceList.grid(row=0, column=0, padx=8)
       scrollbarA.config(command = attendanceList.yview)



       self.btnDisplay = Button(ButtonFrameA, text='Display', font=('ariel',20,'bold'),height=1,width=10, bd=4, command=viewData)
       self.btnDisplay.grid(row=0, column=0)

       self.btnClear = Button(ButtonFrameA, text='Clear', font=('ariel',20,'bold'),height=1,width=10, bd=4, command=Clear)
       self.btnClear.grid(row=0, column=1)

       self.btnDelete = Button(ButtonFrameA, text='Delete', font=('ariel',20,'bold'),height=1,width=10, bd=4, command = deleteData)
       self.btnDelete.grid(row=0, column=2)

       self.btnSearch = Button(ButtonFrameA, text='Search', font=('ariel',20,'bold'),height=1,width=10, bd=4, command = searchDatabase)
       self.btnSearch.grid(row=0, column=3)



       self.btnUpdate = Button(ButtonFrameA, text='Update', font=('ariel',20,'bold'),height=1,width=10, bd=4, command = Update)
       self.btnUpdate.grid(row=0, column=4)

       self.btnQuit = Button(ButtonFrameA, text='Quit', font=('ariel',20,'bold'),height=1,width=10, bd=4, command=Exit)
       self.btnQuit.grid(row=0, column=5)


class Page3(Page):
   def __init__(self, root, *args, **kwargs):
       Page.__init__(self, *args, **kwargs)
       self.root =root
        #self.root.title("ODIN Viewing Test Page")
        #self.root.geometry("1350x750+0+0")
        #self.root.config(bg="ghost white")



       TestTopic = StringVar()
       TestMaxMark  = StringVar()
       TestDate  = StringVar()
       StudentName = StringVar()
       StudentMarkT = StringVar()

        #function
       def addData():
           if(len(TestTopic.get())!=0):
               NEA_SQL_IIII.StudentTest(TestTopic.get(), TestMaxMark.get(), TestDate.get(), StudentName.get(), StudentMarkT.get())
               homeworkList.delete(0,END)
               homeworkList.insert(END,(TestTopic.get(), TestMaxMark.get(), TestDate.get(), StudentName.get(), StudentMarkT.get()))

       def Clear():
           self.entTestTopic.delete(0,END)
           self.entTestMaxMark.delete(0,END)
           self.entTestDate.delete(0,END)
           self.entStudentName.delete(0,END)
           self.entStudentMarkT.delete(0,END)


       def Exit():
           Exit = tkinter.messagebox.askyesno("ODIN","Do you wish to exit?")
           if Exit > 0:
               root.destroy()
               return

       def searchDatabase():
           testListV.delete(0,END)
           for row in NEA_SQL_IIII.searchVT(StudentName.get()):
               testListV.insert(END,row,str(""))


       def viewData():
           testList.delete(0,END)
           for row in NEA_SQL_IIII.displayVT():
               testListV.insert(END,row,str(""))

       def deleteData():
           if(len(StudentName.get())!=0):
               NEA_SQL_IIII.DeleteDataVT(sd[0])
               Clear()
               viewData()

       def TestRec(event):
           global sd
           searchTest = testListV.curselection()[0]
           sd = testListV.get(searchTest)

           self.entTestTopic.delete(0,END)
           self.entTestTopic.insert(END,sd[0])
           self.entTestMaxMark.delete(0,END)
           self.entTestMaxMark.insert(END,sd[1])
           self.entTestDate.delete(0,END)
           self.entTestDate.insert(END,sd[2])
           self.entStudentName.delete(0,END)
           self.entStudentName.insert(END,sd[3])
           self.entStudentMarkT.delete(0,END)
           self.entStudentMarkT.insert(END,sd[4])

       def Update():
           if(len(StudentID.get())!=0):
               NEA_SQL_IIII.DeleteDataVT(sd[0])
           if(len(StudentID.get())!=0):
               NEA_SQL_IIII.addTest(TestTopic.get(),TestMaxMark.get(),TestDate.get())
               testListV.delete(0,END)
               testListV.insert(END,(TestTopic.get(),TestMaxMark.get(),TestDate.get()))



       MainFrameVT = Frame(bg="Ghost White")
       MainFrameVT.pack(side="top", fill="both", expand=True)

       TitFrameVT = Frame(MainFrameVT, bd=2, padx=54, pady=8, bg="Ghost White", relief = RIDGE)
       TitFrameVT.pack(side=TOP)

       self.lblTit = Label(TitFrameVT ,font=('ariel', 47,'bold'),text="ODIN Viewing Test Page",bg="Ghost White")
       self.lblTit.grid()

       ButtonFrameVT = Frame(MainFrameVT, bd=2, width=1350, height=70, padx=18, pady=10, bg="blue2", relief = RIDGE)
       ButtonFrameVT.pack(side=BOTTOM)

       DataFrameVT = Frame(MainFrameVT, bd=1, width=1300, height=400, padx=20, pady=20, bg="ghost white", relief = RIDGE)
       DataFrameVT.pack(side=BOTTOM)

        #DataFrameTOP = LabelFrame(DataFrame, bd=1, width=1000, height=300, padx=20, pady=4, relief = RIDGE,  bg="Ghost White", font=('ariel', 20,'bold'), text = "Student Info\n")
        #DataFrameTOP.pack(side=TOP)

       DataFrameVTLEFT = LabelFrame(DataFrameVT, bd=1, width=450, height=200, padx=20,pady=3, bg="Ghost White", relief = RIDGE, font=('ariel', 20,'bold'), text = "Student Info\n")
       DataFrameVTLEFT.pack(side=LEFT)


       DataFrameVTRIGHT = LabelFrame(DataFrameVT, bd=1, width=450, height=200, padx=31,pady=3, bg="Ghost White", relief = RIDGE, font=('ariel', 20,'bold'), text = "Student Details\n")
       DataFrameVTRIGHT.pack(side=RIGHT)





       self.lblTestTopic = Label(DataFrameVTLEFT ,font=('ariel', 11,'bold'),text="Test Topic", padx=2, pady=2, bg="Ghost White")
       self.lblTestTopic.grid(row=0, column=0, sticky=W)
       self.entTestTopic = Entry(DataFrameVTLEFT ,font=('ariel', 11,'bold'),textvariable=TestTopic,  width=39)
       self.entTestTopic.grid(row=0, column=1)



       self.lblTestMaxMark = Label(DataFrameVTLEFT ,font=('ariel', 11,'bold'),text="Test Max Mark", padx=2, pady=2, bg="Ghost White")
       self.lblTestMaxMark.grid(row=1, column=0, sticky=W)
       self.entTestMaxMark = Entry(DataFrameVTLEFT ,font=('ariel', 11,'bold'),textvariable=TestMaxMark,  width=39)
       self.entTestMaxMark.grid(row=1, column=1)

       self.lblTestDate = Label(DataFrameVTLEFT ,font=('ariel', 11,'bold'),text="Test Date", padx=2, pady=2, bg="Ghost White")
       self.lblTestDate.grid(row=2, column=0, sticky=W)
       self.entTestDate = Entry(DataFrameVTLEFT ,font=('ariel', 11,'bold'),textvariable=TestDate,  width=39)
       self.entTestDate.grid(row=2, column=1)

       self.lblStudentName = Label(DataFrameVTLEFT ,font=('ariel', 11,'bold'),text="Student Name", padx=2, pady=2, bg="Ghost White")
       self.lblStudentName.grid(row=3, column=0, sticky=W)
       self.entStudentName = Entry(DataFrameVTLEFT ,font=('ariel', 11,'bold'),textvariable=StudentName,  width=39)
       self.entStudentName.grid(row=3, column=1)

       self.lblStudentMarkT = Label(DataFrameVTLEFT ,font=('ariel', 11,'bold'),text="Student Mark", padx=2, pady=2, bg="Ghost White")
       self.lblStudentMarkT.grid(row=4, column=0, sticky=W)
       self.entStudentMarkT = Entry(DataFrameVTLEFT ,font=('ariel', 11,'bold'),textvariable=StudentMarkT,  width=39)
       self.entStudentMarkT.grid(row=4, column=1)






       scrollbarVT = Scrollbar(DataFrameVTRIGHT)
       scrollbarVT.grid(row=0, column=1, sticky = 'ns')

       testListV = Listbox(DataFrameVTRIGHT, width=41, height=16, font=('ariel',12,'bold'), yscrollcommand=scrollbarVT.set)
       testListV.bind('<<ListboxSelect>>',TestRec)
       testListV.grid(row=0, column=0, padx=8)
       scrollbarVT.config(command = testListV.yview)


       self.btnAddDate = Button(ButtonFrameVT, text='Add Test', font=('ariel',20,'bold'),height=1,width=10, bd=4, command=addData)
       self.btnAddDate.grid(row=0, column=0)

       self.btnDisplay = Button(ButtonFrameVT, text='Display', font=('ariel',20,'bold'),height=1,width=10, bd=4, command=viewData)
       self.btnDisplay.grid(row=0, column=1)

       self.btnClear = Button(ButtonFrameVT, text='Clear', font=('ariel',20,'bold'),height=1,width=10, bd=4, command=Clear)
       self.btnClear.grid(row=0, column=2)

       self.btnDelete = Button(ButtonFrameVT, text='Delete', font=('ariel',20,'bold'),height=1,width=10, bd=4, command = deleteData)
       self.btnDelete.grid(row=0, column=3)

       self.btnSearch = Button(ButtonFrameVT, text='Search', font=('ariel',20,'bold'),height=1,width=10, bd=4, command = searchDatabase)
       self.btnSearch.grid(row=0, column=4)

        #self.btnUpdate = Button(ButtonFrame, text='Update', font=('ariel',20,'bold'),height=1,width=10, bd=4, command = updateData)
        #self.btnUpdate.grid(row=0, column=4)

       self.btnUpdate = Button(ButtonFrameVT, text='Update', font=('ariel',20,'bold'),height=1,width=10, bd=4, command = Update)
       self.btnUpdate.grid(row=0, column=5)

       self.btnQuit = Button(ButtonFrameVT, text='Quit', font=('ariel',20,'bold'),height=1,width=10, bd=4, command=Exit)
       self.btnQuit.grid(row=0, column=5

class MainView(tk.Frame):
    def __init__(self, *args, **kwargs):
        tk.Frame.__init__(self, *args, **kwargs)
        p1 = Page1(self)
        p2 = Page2(self)
        p3 = Page3(self)

        buttonframe = tk.Frame(self)
        container = tk.Frame(self)
        buttonframe.pack(side=TOP, fill="x", expand=False)
        container.pack(side=BOTTOM, fill="both", expand=True)

        p1.place(in_=container)#, x=0, y=0, relwidth=1, relheight=1)
        p2.place(in_=container)#, x=0, y=0, relwidth=1, relheight=1)
        p3.place(in_=container)#, x=0, y=0, relwidth=1, relheight=1)

        b1 = tk.Button(buttonframe, text="Page 1", command=p1.lift)
        b2 = tk.Button(buttonframe, text="Page 2", command=p2.lift)
        b3 = tk.Button(buttonframe, text="Page 3", command=p3.lift)

        b1.pack(side=LEFT)
        b2.pack(side=LEFT)
        b3.pack(side=LEFT)

        p1.show()

if __name__ == "__main__":
    root = tk.Tk()
    main = MainView(root)
    main.pack(side="top", fill="both", expand=True)
    root.wm_geometry("1350x750+0+0")
    root.mainloop()

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...