#! /usr/bin/env python
#  -*- coding: utf-8 -*-
#
# GUI module generated by PAGE version 4.25.1
#  in conjunction with Tcl version 8.6
#    Jan 13, 2020 05:23:32 PM CST  platform: Windows NT

import sys

try:
    import Tkinter as tk
except ImportError:
    import tkinter as tk

try:
    import ttk
    py3 = False
except ImportError:
    import tkinter.ttk as ttk
    py3 = True

import Homepage_support

def vp_start_gui():
    '''Starting point when module is the main routine.'''
    global val, w, root
    root = tk.Tk()
    Homepage_support.set_Tk_var()
    top = Homepage (root)
    Homepage_support.init(root, top)
    root.mainloop()

w = None
def create_Toplevel1(root, *args, **kwargs):
    '''Starting point when module is imported by another program.'''
    global w, w_win, rt
    rt = root
    w = tk.Toplevel (root)
    Homepage_support.set_Tk_var()
    top = Homepage (w)
    Homepage_support.init(w, top, *args, **kwargs)
    return (w, top)

def destroy_Toplevel1():
    global w
    w.destroy()
    w = None

class Homepage:
    def __init__(self, top=None):
        '''This class configures and populates the toplevel window.
           top is the toplevel containing window.'''
        _bgcolor = '#d9d9d9'  # X11 color: 'gray85'
        _fgcolor = '#000000'  # X11 color: 'black'
        _compcolor = '#d9d9d9' # X11 color: 'gray85'
        _ana1color = '#d9d9d9' # X11 color: 'gray85'
        _ana2color = '#ececec' # Closest X11 color: 'gray92'
        self.style = ttk.Style()
        if sys.platform == "win32":
            self.style.theme_use('winnative')
        self.style.configure('.',background=_bgcolor)
        self.style.configure('.',foreground=_fgcolor)
        self.style.configure('.',font="TkDefaultFont")
        self.style.map('.',background=
            [('selected', _compcolor), ('active',_ana2color)])

        window_width = 1200
        window_height = 651
        screen_width = top.winfo_screenwidth()
        screen_height = top.winfo_screenheight()
        x_coordinate = int((screen_width / 2) - (window_width / 2))
        y_coordinate = int((screen_height / 2) - (window_height / 2))
        top.geometry("{}x{}+{}+{}".format(window_width, window_height, x_coordinate, y_coordinate))
        top.title("Scheduling System")
        top.configure(background="#d9d9d9")
        top.configure(highlightbackground="#d9d9d9")
        top.configure(highlightcolor="black")
        top.resizable(False, False)

        self.selectFile_btn = tk.Button(top)
        self.selectFile_btn.place(relx=0.008, rely=0.015, height=44, width=157)
        self.selectFile_btn.configure(activebackground="#ffffff")
        self.selectFile_btn.configure(activeforeground="#000000")
        self.selectFile_btn.configure(background="#ffffff")
        self.selectFile_btn.configure(disabledforeground="#a3a3a3")
        self.selectFile_btn.configure(font="-family {Segoe UI} -size 10")
        self.selectFile_btn.configure(foreground="#000000")
        self.selectFile_btn.configure(highlightbackground="#d9d9d9")
        self.selectFile_btn.configure(highlightcolor="black")
        self.selectFile_btn.configure(pady="0")
        self.selectFile_btn.configure(relief="ridge")
        self.selectFile_btn.configure(text='''Select File''')

        self.teachers_btn = tk.Button(top)
        self.teachers_btn.place(relx=0.433, rely=0.015, height=44, width=157)
        self.teachers_btn.configure(activebackground="#ffffff")
        self.teachers_btn.configure(activeforeground="#000000")
        self.teachers_btn.configure(background="#ffffff")
        self.teachers_btn.configure(disabledforeground="#a3a3a3")
        self.teachers_btn.configure(font="-family {Segoe UI} -size 10")
        self.teachers_btn.configure(foreground="#000000")
        self.teachers_btn.configure(highlightbackground="#d9d9d9")
        self.teachers_btn.configure(highlightcolor="black")
        self.teachers_btn.configure(pady="0")
        self.teachers_btn.configure(relief="ridge")
        self.teachers_btn.configure(text='''Teachers''')

        self.rooms_btn = tk.Button(top)
        self.rooms_btn.place(relx=0.575, rely=0.015, height=44, width=157)
        self.rooms_btn.configure(activebackground="#ffffff")
        self.rooms_btn.configure(activeforeground="#000000")
        self.rooms_btn.configure(background="#ffffff")
        self.rooms_btn.configure(disabledforeground="#a3a3a3")
        self.rooms_btn.configure(font="-family {Segoe UI} -size 10")
        self.rooms_btn.configure(foreground="#000000")
        self.rooms_btn.configure(highlightbackground="#d9d9d9")
        self.rooms_btn.configure(highlightcolor="black")
        self.rooms_btn.configure(pady="0")
        self.rooms_btn.configure(relief="ridge")
        self.rooms_btn.configure(text='''Rooms''')

        self.subject_btn = tk.Button(top)
        self.subject_btn.place(relx=0.292, rely=0.015, height=44, width=157)
        self.subject_btn.configure(activebackground="#ffffff")
        self.subject_btn.configure(activeforeground="#000000")
        self.subject_btn.configure(background="#ffffff")
        self.subject_btn.configure(disabledforeground="#a3a3a3")
        self.subject_btn.configure(font="-family {Segoe UI} -size 10")
        self.subject_btn.configure(foreground="#000000")
        self.subject_btn.configure(highlightbackground="#d9d9d9")
        self.subject_btn.configure(highlightcolor="black")
        self.subject_btn.configure(pady="0")
        self.subject_btn.configure(relief="ridge")
        self.subject_btn.configure(text='''Subjects''')

        self.schoolYear_btn = tk.Button(top)
        self.schoolYear_btn.place(relx=0.15, rely=0.015, height=44
                , width=157)
        self.schoolYear_btn.configure(activebackground="#ffffff")
        self.schoolYear_btn.configure(activeforeground="#000000")
        self.schoolYear_btn.configure(background="#ffffff")
        self.schoolYear_btn.configure(disabledforeground="#a3a3a3")
        self.schoolYear_btn.configure(font="-family {Segoe UI} -size 10")
        self.schoolYear_btn.configure(foreground="#000000")
        self.schoolYear_btn.configure(highlightbackground="#d9d9d9")
        self.schoolYear_btn.configure(highlightcolor="black")
        self.schoolYear_btn.configure(pady="0")
        self.schoolYear_btn.configure(relief="ridge")
        self.schoolYear_btn.configure(text='''School Year''')

        self.teacherSchedule_btn = tk.Button(top)
        self.teacherSchedule_btn.place(relx=0.717, rely=0.015, height=44
                , width=157)
        self.teacherSchedule_btn.configure(activebackground="#ffffff")
        self.teacherSchedule_btn.configure(activeforeground="#000000")
        self.teacherSchedule_btn.configure(background="#ffffff")
        self.teacherSchedule_btn.configure(disabledforeground="#a3a3a3")
        self.teacherSchedule_btn.configure(font="-family {Segoe UI} -size 10")
        self.teacherSchedule_btn.configure(foreground="#000000")
        self.teacherSchedule_btn.configure(highlightbackground="#d9d9d9")
        self.teacherSchedule_btn.configure(highlightcolor="black")
        self.teacherSchedule_btn.configure(pady="0")
        self.teacherSchedule_btn.configure(relief="ridge")
        self.teacherSchedule_btn.configure(text='''Teacher's Schedule''')

        self.TSeparator1 = ttk.Separator(top)
        self.TSeparator1.place(relx=0.0, rely=0.108, relwidth=1.008)

        self.menubar = tk.Menu(top,font="TkMenuFont",bg=_bgcolor,fg=_fgcolor)
        top.configure(menu = self.menubar)

        self.grade_lbl = tk.Label(top)
        self.grade_lbl.place(relx=0.008, rely=0.154, height=31, width=74)
        self.grade_lbl.configure(activebackground="#f9f9f9")
        self.grade_lbl.configure(activeforeground="black")
        self.grade_lbl.configure(background="#d9d9d9")
        self.grade_lbl.configure(disabledforeground="#a3a3a3")
        self.grade_lbl.configure(font="-family {Segoe UI} -size 14")
        self.grade_lbl.configure(foreground="#000000")
        self.grade_lbl.configure(highlightbackground="#d9d9d9")
        self.grade_lbl.configure(highlightcolor="black")
        self.grade_lbl.configure(text='''Grade:''')

        self.grade_var = tk.StringVar()
        self.grade_box = ttk.Combobox(top)
        self.grade_box.place(relx=0.067, rely=0.154, relheight=0.048
                , relwidth=0.119)
        self.grade_box.configure(font="-family {Segoe UI} -size 12")
        self.grade_box.configure(textvariable=self.grade_var)
        self.grade_box.configure(takefocus="")
        self.grade_box.configure(state="readonly")

        self.section_lbl = tk.Label(top)
        self.section_lbl.place(relx=0.208, rely=0.154, height=31, width=74)
        self.section_lbl.configure(activebackground="#f9f9f9")
        self.section_lbl.configure(activeforeground="black")
        self.section_lbl.configure(background="#d9d9d9")
        self.section_lbl.configure(disabledforeground="#a3a3a3")
        self.section_lbl.configure(font="-family {Segoe UI} -size 14")
        self.section_lbl.configure(foreground="#000000")
        self.section_lbl.configure(highlightbackground="#d9d9d9")
        self.section_lbl.configure(highlightcolor="black")
        self.section_lbl.configure(text='''Section:''')

        self.section_var = tk.StringVar()
        self.section_box = ttk.Combobox(top)
        self.section_box.place(relx=0.275, rely=0.154, relheight=0.048
                , relwidth=0.119)
        self.section_box.configure(font="-family {Segoe UI} -size 12")
        self.section_box.configure(textvariable=self.section_var)
        self.section_box.configure(takefocus="")
        self.section_box.configure(state="readonly")

        self.search_btn = tk.Button(top)
        self.search_btn.place(relx=0.68, rely=0.154, height=34, width=117)
        self.search_btn.configure(activebackground="#ffffff")
        self.search_btn.configure(activeforeground="#000000")
        self.search_btn.configure(background="#ffffff")
        self.search_btn.configure(disabledforeground="#a3a3a3")
        self.search_btn.configure(font="-family {Segoe UI} -size 12")
        self.search_btn.configure(foreground="#000000")
        self.search_btn.configure(highlightbackground="#d9d9d9")
        self.search_btn.configure(highlightcolor="black")
        self.search_btn.configure(pady="0")
        self.search_btn.configure(relief="ridge")
        self.search_btn.configure(text='''Search''')

        self.schedule_lbl = tk.Label(top)
        self.schedule_lbl.place(relx=0.013, rely=0.23, height=41, width=104)
        self.schedule_lbl.configure(activebackground="#f9f9f9")
        self.schedule_lbl.configure(activeforeground="black")
        self.schedule_lbl.configure(background="#d9d9d9")
        self.schedule_lbl.configure(disabledforeground="#a3a3a3")
        self.schedule_lbl.configure(font="-family {Segoe UI} -size 14 -weight bold")
        self.schedule_lbl.configure(foreground="#000000")
        self.schedule_lbl.configure(highlightbackground="#d9d9d9")
        self.schedule_lbl.configure(highlightcolor="black")
        self.schedule_lbl.configure(text='''SCHEDULE''')

        self.style.configure('Treeview.Heading',  font="TkDefaultFont")
        self.schedule_treeview = ScrolledTreeView(top, columns=("subject", "time_in", "time_out", "teacher", "room"), show="headings")
        self.schedule_treeview.place(relx=0.008, rely=0.307, relheight=0.671
                , relwidth=0.983)
        self.heading = ["Subject", "Time In", "Time Out", "Teacher", "Room"]
        for i in range(len(self.heading)):
            self.schedule_treeview.heading(i, text="{}".format(self.heading[i]))
            self.schedule_treeview.column(i, anchor="center")

        self.activeSY_lbl = tk.Label(top)
        self.activeSY_lbl.place(relx=0.4, rely=0.154, height=31, width=164)
        self.activeSY_lbl.configure(activebackground="#f9f9f9")
        self.activeSY_lbl.configure(activeforeground="black")
        self.activeSY_lbl.configure(background="#d9d9d9")
        self.activeSY_lbl.configure(disabledforeground="#a3a3a3")
        self.activeSY_lbl.configure(font="-family {Segoe UI} -size 14")
        self.activeSY_lbl.configure(foreground="#000000")
        self.activeSY_lbl.configure(highlightbackground="#d9d9d9")
        self.activeSY_lbl.configure(highlightcolor="black")
        self.activeSY_lbl.configure(text='''School Year:''')

        self.SY_var = tk.StringVar()
        self.SY_box = ttk.Combobox(top)
        self.SY_box.place(relx=0.52, rely=0.154, relheight=0.048, relwidth=0.119)
        self.SY_box.configure(font="-family {Segoe UI} -size 12")
        self.SY_box.configure(textvariable=self.SY_var)
        self.SY_box.configure(takefocus="")
        self.SY_box.configure(state="readonly")

# The following code is added to facilitate the Scrolled widgets you specified.
class AutoScroll(object):
    '''Configure the scrollbars for a widget.'''

    def __init__(self, master):
        #  Rozen. Added the try-except clauses so that this class
        #  could be used for scrolled entry widget for which vertical
        #  scrolling is not supported. 5/7/14.
        try:
            vsb = ttk.Scrollbar(master, orient='vertical', command=self.yview)
        except:
            pass
        hsb = ttk.Scrollbar(master, orient='horizontal', command=self.xview)

        #self.configure(yscrollcommand=_autoscroll(vsb),
        #    xscrollcommand=_autoscroll(hsb))
        try:
            self.configure(yscrollcommand=self._autoscroll(vsb))
        except:
            pass
        self.configure(xscrollcommand=self._autoscroll(hsb))

        self.grid(column=0, row=0, sticky='nsew')
        try:
            vsb.grid(column=1, row=0, sticky='ns')
        except:
            pass
        hsb.grid(column=0, row=1, sticky='ew')

        master.grid_columnconfigure(0, weight=1)
        master.grid_rowconfigure(0, weight=1)

        # Copy geometry methods of master  (taken from ScrolledText.py)
        if py3:
            methods = tk.Pack.__dict__.keys() | tk.Grid.__dict__.keys() \
                  | tk.Place.__dict__.keys()
        else:
            methods = tk.Pack.__dict__.keys() + tk.Grid.__dict__.keys() \
                  + tk.Place.__dict__.keys()

        for meth in methods:
            if meth[0] != '_' and meth not in ('config', 'configure'):
                setattr(self, meth, getattr(master, meth))

    @staticmethod
    def _autoscroll(sbar):
        '''Hide and show scrollbar as needed.'''
        def wrapped(first, last):
            first, last = float(first), float(last)
            if first <= 0 and last >= 1:
                sbar.grid_remove()
            else:
                sbar.grid()
            sbar.set(first, last)
        return wrapped

    def __str__(self):
        return str(self.master)

def _create_container(func):
    '''Creates a ttk Frame with a given master, and use this new frame to
    place the scrollbars and the widget.'''
    def wrapped(cls, master, **kw):
        container = ttk.Frame(master)
        container.bind('<Enter>', lambda e: _bound_to_mousewheel(e, container))
        container.bind('<Leave>', lambda e: _unbound_to_mousewheel(e, container))
        return func(cls, container, **kw)
    return wrapped

class ScrolledTreeView(AutoScroll, ttk.Treeview):
    '''A standard ttk Treeview widget with scrollbars that will
    automatically show/hide as needed.'''
    @_create_container
    def __init__(self, master, **kw):
        ttk.Treeview.__init__(self, master, **kw)
        AutoScroll.__init__(self, master)

import platform
def _bound_to_mousewheel(event, widget):
    child = widget.winfo_children()[0]
    if platform.system() == 'Windows' or platform.system() == 'Darwin':
        child.bind_all('<MouseWheel>', lambda e: _on_mousewheel(e, child))
        child.bind_all('<Shift-MouseWheel>', lambda e: _on_shiftmouse(e, child))
    else:
        child.bind_all('<Button-4>', lambda e: _on_mousewheel(e, child))
        child.bind_all('<Button-5>', lambda e: _on_mousewheel(e, child))
        child.bind_all('<Shift-Button-4>', lambda e: _on_shiftmouse(e, child))
        child.bind_all('<Shift-Button-5>', lambda e: _on_shiftmouse(e, child))

def _unbound_to_mousewheel(event, widget):
    if platform.system() == 'Windows' or platform.system() == 'Darwin':
        widget.unbind_all('<MouseWheel>')
        widget.unbind_all('<Shift-MouseWheel>')
    else:
        widget.unbind_all('<Button-4>')
        widget.unbind_all('<Button-5>')
        widget.unbind_all('<Shift-Button-4>')
        widget.unbind_all('<Shift-Button-5>')

def _on_mousewheel(event, widget):
    if platform.system() == 'Windows':
        widget.yview_scroll(-1*int(event.delta/120),'units')
    elif platform.system() == 'Darwin':
        widget.yview_scroll(-1*int(event.delta),'units')
    else:
        if event.num == 4:
            widget.yview_scroll(-1, 'units')
        elif event.num == 5:
            widget.yview_scroll(1, 'units')

def _on_shiftmouse(event, widget):
    if platform.system() == 'Windows':
        widget.xview_scroll(-1*int(event.delta/120), 'units')
    elif platform.system() == 'Darwin':
        widget.xview_scroll(-1*int(event.delta), 'units')
    else:
        if event.num == 4:
            widget.xview_scroll(-1, 'units')
        elif event.num == 5:
            widget.xview_scroll(1, 'units')

if __name__ == '__main__':
    vp_start_gui()





