コード例 #1
0
    def __init__(self,parent,controller):
        array = []
        tk.Frame.__init__(self,parent, bg = "orange red")
        label=tk.Label(self,text="Edit",font=LARGE_FONT,bg="orange red")
        label.grid(row=0,column=1,padx=20,sticky=N)

        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)
        def Refresh():
            array = XL.getStudents()
            listbox.delete(0,END)
            for item in array:
                listbox.insert(END,item)
                listbox.insert(END," ")
        
        scrollbar = Scrollbar(self)
        scrollbar.grid(row=3,column=2,sticky=N+S,padx=50)
        listbox = Listbox(self,yscrollcommand=scrollbar.set,height=10)
        listbox.grid(row=3,column=1,pady = 20)
        scrollbar.config(command=listbox.yview)
        array = XL.getStudents()
        for item in array:
            listbox.insert(END,item)
            listbox.insert(END," ")
        #Delete Button
        delete=tk.Button(self,text="Remove",relief="raised",padx=4,pady=4,bd=4,
                height=2,width=10,command = lambda: Delete())
        delete.grid(row=3,column=3)
        def Delete():
            selection = listbox.selection_get()
            XL.delStudent(selection)
            Refresh()
        #add button
        add=tk.Button(self,text="Add Student",relief="raised",padx=4,pady=4,bd=4,
                height=2,width=10,command = lambda: Add())
        add.grid(row=0,column=3)
        def Add():
            XL.setLastPage("EditStudents")
            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("EditStudents")
            controller.show_frame(EditPage)
コード例 #2
0
 def Refresh():
     array = XL.getStudents()
     listbox.delete(0,END)
     for item in array:
         listbox.insert(END,item)
         listbox.insert(END," ")