Exemple #1
0
 def update_student(self):
     if not self.rows:
         messagebox.showerror("Error",
                              "Choose a student from the table first")
         return
     elif not SISdatabase.info_checker(self.id_no.get(),
                                       self.name.get().upper(),
                                       self.year.get(),
                                       self.course.get().upper(),
                                       self.gender.get().upper()):
         return
     else:
         if messagebox.askyesno(
                 "Update Course",
                 "Do you wish to update the student information?"):
             if SISdatabase.update_student_rec(self.rows[0],
                                               self.id_no.get(),
                                               self.name.get().upper(),
                                               self.year.get(),
                                               self.course.get().upper(),
                                               self.gender.get()):
                 messagebox.showinfo(
                     "Success", "Information on student has been updated!")
                 self.clear_data()
                 self.rows = []
                 displaytable.display_student_table(self.student_table)
Exemple #2
0
 def delete_student(self):
     cursor_row = self.student_table.focus()
     contents = self.student_table.item(cursor_row)
     rows = contents['values']
     if rows == "":
         messagebox.showerror("Error", "Select a student first!")
     else:
         if messagebox.askyesno("Delete Student",
                                "Do you wish to delete this student?"):
             SISdatabase.delete_student_rec(rows[0])
             messagebox.showinfo("Success", "Student deleted in database!")
             disp.display_student_table(self.student_table)
             self.default_layout()
             return
         else:
             return
Exemple #3
0
 def add_student(self):
     if messagebox.askyesno(
             "Add Student",
             "Do you want to add the student in the database"):
         if not SISdatabase.info_checker(self.id_no.get(),
                                         self.name.get().upper(),
                                         self.year.get(),
                                         self.course.get().upper(),
                                         self.gender.get().upper()):
             return
         else:
             if SISdatabase.add_student_rec(self.id_no.get(),
                                            self.name.get().upper(),
                                            self.year.get(),
                                            self.course.get().upper(),
                                            self.gender.get()):
                 messagebox.showinfo("Success", "Student added to database")
                 self.clear_data()
                 displaytable.display_student_table(self.student_table)
             else:
                 return
Exemple #4
0
    def __init__(self, frame):
        self.dashboard_cont_frame = frame

        self.student_dshbrd_img = PhotoImage(file=r"images\dashboardstud.png")
        student_count_dash = Label(self.dashboard_cont_frame,
                                   image=self.student_dshbrd_img)
        student_count_dash.photo = self.student_dshbrd_img
        student_count_dash.place(x=20, y=20, width=250, height=120)
        self.student_count = Label(self.dashboard_cont_frame,
                                   text="1000",
                                   font=("Blinker", 40, "bold"),
                                   fg="#A51d23",
                                   bg="#FA9412")
        self.student_count.place(x=20, y=20, width=140, height=77)

        self.course_dshbrd_img = PhotoImage(file=r"images\dashboardcourse.png")
        course_count_dash = Label(self.dashboard_cont_frame,
                                  image=self.course_dshbrd_img)
        course_count_dash.photo = self.course_dshbrd_img
        course_count_dash.place(x=290, y=20, width=250, height=120)
        self.course_count = Label(self.dashboard_cont_frame,
                                  text="0",
                                  font=("Blinker", 40, "bold"),
                                  bg="#A51d23",
                                  fg="#FA9412")
        self.course_count.place(x=290, y=20, width=140, height=77)

        self.bg_frame = Frame(self.dashboard_cont_frame, bg="white")

        self.stud_list_label = Label(self.dashboard_cont_frame,
                                     bg="#A51d23",
                                     fg="white",
                                     text="  LIST OF STUDENTS",
                                     font=("Blinker", 15, "bold"),
                                     anchor="w")
        self.stud_list_frame = Frame(self.dashboard_cont_frame,
                                     bg="white",
                                     highlightbackground="#A51d23",
                                     highlightthickness=2)

        self.course_label = Label(self.dashboard_cont_frame,
                                  bg="#A51d23",
                                  fg="white",
                                  text="  LIST OF COURSES",
                                  font=("Blinker", 15, "bold"),
                                  anchor="w")
        self.course_list_frame = Frame(self.dashboard_cont_frame,
                                       bg="white",
                                       highlightbackground="#A51d23",
                                       highlightthickness=2)

        scroll_x_stud_list = Scrollbar(self.stud_list_frame, orient=HORIZONTAL)
        scroll_y_stud_list = Scrollbar(self.stud_list_frame, orient=VERTICAL)

        scroll_x_course_list = Scrollbar(self.course_list_frame,
                                         orient=HORIZONTAL)
        scroll_y_course_list = Scrollbar(self.course_list_frame,
                                         orient=VERTICAL)
        self.student_table = ttk.Treeview(
            self.stud_list_frame,
            xscrollcommand=scroll_x_stud_list.set,
            yscrollcommand=scroll_y_stud_list.set,
            columns=("id_no", "name", "course_code", "year", "gender"))
        scroll_x_stud_list.pack(side=BOTTOM, fill=X)
        scroll_y_stud_list.pack(side=RIGHT, fill=Y)
        scroll_x_stud_list.config(command=self.student_table.xview)
        scroll_y_stud_list.config(command=self.student_table.yview)
        self.student_table.heading("id_no", text="ID Number")
        self.student_table.heading("name", text="Name")
        self.student_table.heading("course_code", text="Course Code")
        self.student_table.heading("year", text="Year")
        self.student_table.heading("gender", text="Gender")
        self.student_table['show'] = 'headings'
        self.student_table.column("id_no", width=70)
        self.student_table.column("name", width=190)
        self.student_table.column("course_code", width=100)
        self.student_table.column("year", width=70)
        self.student_table.column("gender", width=70)

        self.student_table.pack(fill=BOTH, expand=1)

        self.course_table = ttk.Treeview(
            self.course_list_frame,
            xscrollcommand=scroll_x_course_list.set,
            yscrollcommand=scroll_y_course_list.set,
            columns=("course_code", "course"))
        scroll_x_course_list.pack(side=BOTTOM, fill=X)
        scroll_y_course_list.pack(side=RIGHT, fill=Y)
        scroll_x_course_list.config(command=self.course_table.xview)
        scroll_y_course_list.config(command=self.course_table.yview)
        self.course_table.heading("course_code", text="Course Code")
        self.course_table.heading("course", text="Course")
        self.course_table['show'] = 'headings'
        self.course_table.column("course_code", width=50)
        self.course_table.column("course", width=200)

        self.course_table.pack(fill=BOTH, expand=1)

        self.max_student_img = PhotoImage(file=r"images\max.png").subsample(
            5, 5)
        self.max_course_img = PhotoImage(file=r"images\max.png").subsample(
            5, 5)
        self.max_student_button = Button(self.dashboard_cont_frame,
                                         command=self.max_student_table,
                                         relief=FLAT,
                                         bg="#A51d23",
                                         activebackground="#A51d23",
                                         image=self.max_student_img)
        self.max_course_button = Button(self.dashboard_cont_frame,
                                        command=self.max_course_table,
                                        relief=FLAT,
                                        bg="#A51d23",
                                        activebackground="#A51d23",
                                        image=self.max_course_img)

        self.min_image = PhotoImage(file=r"images\min.png").subsample(5, 5)
        self.min_button = Button(self.dashboard_cont_frame,
                                 command=self.default_layout,
                                 relief=FLAT,
                                 fg="white",
                                 bg="#A51d23",
                                 activeforeground="white",
                                 activebackground="#A51d23",
                                 image=self.min_image)
        self.min_button.photo = self.min_image

        self.default_layout()
        self.count_data()
        disp.display_student_table(self.student_table)
        disp.display_course_table(self.course_table)
Exemple #5
0
    def __init__(self, frame):
        self.student_cont_frame = frame

        self.search_stud = StringVar()

        self.add_button_img = PhotoImage(
            file=r"images\addstudent.png").subsample(1, 1)
        self.edit_button_img = PhotoImage(
            file=r"images\editstudent.png").subsample(1, 1)
        self.delete_button_img = PhotoImage(
            file=r"images\deletestudent.png").subsample(1, 1)
        self.srch_img = PhotoImage(
            file=r"images\searchbuttonimg.png").subsample(1, 1)

        add_student_btn = Button(self.student_cont_frame,
                                 bg="#A51d23",
                                 image=self.add_button_img,
                                 command=self.add_student)
        add_student_btn.photo = self.add_button_img
        add_student_btn.place(x=10, y=50, width=70, height=70)

        edit_student_btn = Button(self.student_cont_frame,
                                  bg="#A51d23",
                                  image=self.edit_button_img,
                                  command=self.edit_student)
        edit_student_btn.photo = self.edit_button_img
        edit_student_btn.place(x=85, y=50, width=70, height=70)

        delete_student_btn = Button(self.student_cont_frame,
                                    bg="#A51d23",
                                    image=self.delete_button_img,
                                    command=self.delete_student)
        delete_student_btn.photo = self.delete_button_img
        delete_student_btn.place(x=160, y=50, width=70, height=70)

        search_code_label = Label(self.student_cont_frame,
                                  font=("Blinker", 11, "bold"),
                                  bg="#A51d23",
                                  fg="white",
                                  text="Student ID:")
        search_code_label.place(x=515, y=85, width=80, height=35)
        self.search_student_bar_entry = Entry(self.student_cont_frame,
                                              textvariable=self.search_stud,
                                              font=("Blinker", 15, "bold"),
                                              highlightthickness=2,
                                              highlightbackground="#A51d23")
        self.search_student_bar_entry.place(x=595, y=85, width=250, height=35)
        self.search_stud.trace("w",
                               lambda name, index, mode, sv=self.search_stud:
                               self.search_student())

        search_student_lbl = Label(self.student_cont_frame,
                                   image=self.srch_img)
        search_student_lbl.photo = self.srch_img
        search_student_lbl.place(x=845, y=85, width=35, height=35)

        self.stud_list_label = Label(self.student_cont_frame,
                                     bg="#A51d23",
                                     fg="white",
                                     anchor='w',
                                     text="   LIST OF STUDENTS",
                                     font=("Blinker", 15, "bold"))

        self.stud_list_frame = Frame(self.student_cont_frame,
                                     bg="white",
                                     highlightbackground="#A51d23",
                                     highlightthickness=2)

        self.stud_list_label.place_configure(x=370,
                                             y=140,
                                             width=510,
                                             height=30)
        self.stud_list_frame.place_configure(x=370,
                                             y=170,
                                             width=510,
                                             height=370)

        scroll_x_stud_list = Scrollbar(self.stud_list_frame, orient=HORIZONTAL)
        scroll_y_stud_list = Scrollbar(self.stud_list_frame, orient=VERTICAL)
        self.student_table = ttk.Treeview(
            self.stud_list_frame,
            xscrollcommand=scroll_x_stud_list.set,
            yscrollcommand=scroll_y_stud_list.set,
            columns=("id_no", "name", "course_code", "year", "gender"))
        scroll_x_stud_list.pack(side=BOTTOM, fill=X)
        scroll_y_stud_list.pack(side=RIGHT, fill=Y)
        scroll_x_stud_list.config(command=self.student_table.xview)
        scroll_y_stud_list.config(command=self.student_table.yview)
        self.student_table.heading("id_no", text="ID Number")
        self.student_table.heading("name", text="Name")
        self.student_table.heading("course_code", text="Course")
        self.student_table.heading("year", text="Year")
        self.student_table.heading("gender", text="Gender")
        self.student_table['show'] = 'headings'
        self.student_table.column("id_no", width=70)
        self.student_table.column("name", width=170)
        self.student_table.column("course_code", width=70)
        self.student_table.column("year", width=60)
        self.student_table.column("gender", width=60)

        self.student_table.pack(fill=BOTH, expand=1)

        self.heading_label = Label(self.student_cont_frame,
                                   bg="#A51d23",
                                   fg="white",
                                   anchor='w',
                                   font=("Blinker", 15, "bold"))
        self.heading_label.place(x=10, y=140, width=340, height=30)

        self.features_frame = Frame(self.student_cont_frame,
                                    bg="white",
                                    highlightbackground="#A51d23",
                                    highlightthickness=2)
        self.add_student_frame = Frame(self.student_cont_frame,
                                       bg="white",
                                       highlightbackground="#A51d23",
                                       highlightthickness=2)
        self.edit_student_frame = Frame(self.student_cont_frame,
                                        bg="white",
                                        highlightbackground="#A51d23",
                                        highlightthickness=2)

        self.default_layout()
        disp.display_student_table(self.student_table)