# ************************************************** HEADING PART ****************************************************************

from msilib.schema import ListBox
from tkinter import *            #tkinter is the main library or module for craeting gui
from tkinter.ttk import *

root=Tk()                        #This is the main window of name root1

root.title("Question & Answer")  #This is the name of program displayed on title bar

root.geometry("800x650+400+100") # this sets the size of window

# ********************************************************************************************************************************

#creating the frames for different pages 

s = Style()
s.configure('My.TFrame', background='white')

home_page=Frame(root,style='My.TFrame')
search_page=Frame(root,style='My.TFrame')
append_page=Frame(root,style='My.TFrame')


Welcome_text=Label(home_page,text='Home Page',font=('Georgia',20),foreground='#00ff9d',background='white').pack() # this is text to display

def open_home_page():
    home_page.pack(fill='both', expand=1)
    search_page.pack_forget()
    append_page.pack_forget()

def open_search_page():
    but5=Button(search_page,text='Home Page',command=open_home_page).place(x=400,y=500)
    but6=Button(search_page,text='Add Page',command=open_append_page).place(x=400,y=550)
    search_page.pack(fill='both', expand=1)
    home_page.pack_forget()
    append_page.pack_forget()


def open_append_page():
    but5=Button(append_page,text='Home Page',command=open_home_page).place(x=400,y=500)
    but6=Button(append_page,text='Search Page',command=open_search_page).place(x=400,y=550)
    append_page.pack(fill='both', expand=1)
    home_page.pack_forget()
    search_page.pack_forget()


# ********************************************************** Menu (root) ******************************************************************

root_menu=Menu(root) # creating a menubar referencing as root_menu 


# $$$$$$$$$$$    adding the first menu called "File"    $$$$$$$$$$$$$$$$

file_menu=Menu(root_menu,tearoff=0)                # creating a menu named file_menu in the main menu called root_menu

root_menu.add_cascade(label='File',menu=file_menu)
file_menu.add_command(label="Open",command=None)
file_menu.add_command(label="Add New Subject",command=None)
file_menu.add_command(label="Delte a Subject",command=None)
file_menu.add_separator()
file_menu.add_command(label="Exit",command=root.destroy)


# $$$$$$$$$$$$   adding the second menu called "Edit"   $$$$$$$$$$$$$$$$$

edit_menu=Menu(root_menu,tearoff=0)

root_menu.add_cascade(label='Edit',menu=edit_menu)
edit_menu.add_command(label='Copy',command=None)
edit_menu.add_command(label='Cut',command=None)
edit_menu.add_command(label='Paste',command=None)


# $$$$$$$$$$$$   adding the third menu called "Options"   $$$$$$$$$$$$$$$$$

option_menu=Menu(root_menu,tearoff=0)

root_menu.add_cascade(label='Options',menu=option_menu)
option_menu.add_command(label='Font',command=None)
option_menu.add_command(label='Background Color',command=None)
option_menu.add_separator()
option_menu.add_command(label='extra',command=None)
option_menu.add_command(label='Full_Screen',command=None)
option_menu.add_command(label='Exit Full_Screen',command=None)



# $$$$$$$$$$$$$$$   adding the forth menu called "Help"   $$$$$$$$$$$$$$$$$

help_menu=Menu(root_menu,tearoff=0)

root_menu.add_cascade(label='Help',menu=help_menu)

help_menu.add_command(label='Our Website',command=None)
help_menu.add_command(label='User Manual',command=None)
help_menu.add_separator()
help_menu.add_command(label='Update',command=None)
help_menu.add_command(label='About',command=None)

#******************************************************End of Menu****************************************************************


# &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& Buttons For Choosing (home_page) &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&


# choosing the class first ---------------------------------------------------------------------------------------------------

text_1=Label(home_page,text='Choose the class : ',foreground='#ff6200',background="white",font=(16)).place(x=50,y=50)

button_class_1=Button(home_page,text='1',width='20',style=(),command=None).place(x=56,y=80)
button_class_2=Button(home_page,text='2',width='20',command=None).place(x=200,y=80)
button_class_3=Button(home_page,text='3',width='20',command=None).place(x=344,y=80)
button_class_4=Button(home_page,text='4',width='20',command=None).place(x=488,y=80)
button_class_5=Button(home_page,text='5',width='20',command=None).place(x=632,y=80)
button_class_6=Button(home_page,text='6',width='20',command=None).place(x=56,y=115)
button_class_7=Button(home_page,text='7',width='20',command=None).place(x=200,y=115)
button_class_8=Button(home_page,text='8',width='20',command=None).place(x=344,y=115)
button_class_9=Button(home_page,text='9',width='20',command=None).place(x=488,y=115)
button_class_10=Button(home_page,text='10',width='20',command=None).place(x=632,y=115)


# choosing the subject ---------------------------------------------------------------------------------------------------------

text_2=Label(home_page,text='Choose the subject : ',foreground='#ff6200',background="white",font=(16)).place(x=50,y=170)

button_suject_science=Button(home_page,text='Science',width='20',style=(),command=None).place(x=56,y=190)
button_subject_math=Button(home_page,text='Math',width='20',command=None).place(x=200,y=190)
button_subject_social=Button(home_page,text='Social',width='20',command=None).place(x=344,y=190)
button_subject_computer=Button(home_page,text='Computer',width='20',command=None).place(x=488,y=190)
button_subject_english=Button(home_page,text='English',width='20',command=None).place(x=632,y=190)
button_subject_EPH=Button(home_page,text='E.P.H',width='20',command=None).place(x=56,y=225)
button_subject_health=Button(home_page,text='Health',width='20',command=None).place(x=200,y=225)
button_subject_OBTE=Button(home_page,text='O.B.T.E',width='20',command=None).place(x=344,y=225)
button_subject_grammar=Button(home_page,text='Grammar',width='20',command=None).place(x=488,y=225)
button_subject_extra=Button(home_page,text='Extra',width='20',command=None).place(x=632,y=225)


# &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&


# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Search Page !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

search_box=Entry(search_page,width=63,font=(20))
search_box.place(x=80,y=10)
# pg=Style()
# pg.configure('but1',backgrond='green')
search_button=Button(search_page,text='Search',command=None).place(x=660,y=10)

# list box
list_frame=Frame(search_page,style='My.TFrame')
list_frame.place(x=80,y=50,width=620,height=350)
list_box=Listbox(list_frame,font=(20))
list_box.pack(fill='both',expand=True)

list_1=["One","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten"]

for item in list_1:
    item1=str(item)
    list_box.insert(END,item1)


# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!




# ======================================================== Append Page ===========================================================


question_box=Entry(append_page,width=75,font=(20))
question_box.place(x=55,y=50)
question_box.insert(0,'Question : ')

answer_box=Text(append_page,width=75,height=20,font=(16))
answer_box.place(x=55,y=100)
answer_box.insert(1.0,'Answer : ')




# Main Buttoms (home_page)

Search_button=Button(home_page,text='Search',command=open_search_page).place(x=100,y=500)
Add_new_button=Button(home_page,text='Add new questions',command=open_append_page).place(x=600,y=500)


home_page.pack(fill='both', expand=1)

# hello=Label(search_page,text="hello world").pack()

root.config(menu=root_menu)
root.mainloop()                  #this tells the program to keep running so that it can dispaly every chnages hapening in the window of the program