#! /usr/bin/env python
#  -*- coding: utf-8 -*-
#
# GUI module generated by PAGE version 4.26
#  in conjunction with Tcl version 8.6
#    Feb 04, 2021 01:12:32 AM +06  platform: Windows NT
import os
import sys
import numpy as np
import cv2
from PIL import Image, ImageTk
from tkinter import filedialog
from tkinter import messagebox
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 classifier_code as clss
import Classifiers_imp as clss
import UI_v_203_support
import UI_Final_year_v202_popup

def vp_start_gui():
    '''Starting point when module is the main routine.'''
    global val, w, root
    root = tk.Tk()
    UI_v_203_support.set_Tk_var()
    top = Toplevel1 (root)
    UI_v_203_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)
    UI_v_203_support.set_Tk_var()
    top = Toplevel1 (w)
    UI_v_203_support.init(w, top, *args, **kwargs)
    return (w, top)

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

class Toplevel1:
    def auto_class(self,event=None):
        print('x')
        self.Label10.destroy()
        self.left_hand_cb.destroy()
        self.right_hand_cb.destroy()
        self.feet_cb.destroy()
        self.tongue_cb.destroy()  
    
    def man_class(self,event=None):
        """"Check buttons"""
        self.Label10 = tk.Label(self.dataset_frame)
        self.Label10.place(relx=0.527, rely=0.27, height=26, width=53)
        self.Label10.configure(activebackground="#f9f9f9")
        self.Label10.configure(activeforeground="black")
        self.Label10.configure(background="#d1b9f9")
        self.Label10.configure(disabledforeground="#a3a3a3")
        self.Label10.configure(foreground="#000000")
        self.Label10.configure(highlightbackground="#d9d9d9")
        self.Label10.configure(highlightcolor="black")
        self.Label10.configure(text='''Classes''')
        
        self.left_hand_cb = tk.Checkbutton(self.dataset_frame)
        self.left_hand_cb.place(relx=0.605, rely=0.27, relheight=0.168
                , relwidth=0.092)
        self.left_hand_cb.configure(activebackground="#ececec")
        self.left_hand_cb.configure(activeforeground="#000000")
        self.left_hand_cb.configure(background="#d9d9d9")
        self.left_hand_cb.configure(disabledforeground="#a3a3a3")
        self.left_hand_cb.configure(foreground="#000000")
        self.left_hand_cb.configure(highlightbackground="#d9d9d9")
        self.left_hand_cb.configure(highlightcolor="black")
        self.left_hand_cb.configure(justify='left')
        self.left_hand_cb.configure(text='''Left Hand''')
        self.left_hand_cb.configure(variable=UI_v_203_support.lf_hnd)
        self.right_hand_cb = tk.Checkbutton(self.dataset_frame)
        self.right_hand_cb.place(relx=0.702, rely=0.27, relheight=0.168
                , relwidth=0.101)
        self.right_hand_cb.configure(activebackground="#ececec")
        self.right_hand_cb.configure(activeforeground="#000000")
        self.right_hand_cb.configure(background="#d9d9d9")
        self.right_hand_cb.configure(disabledforeground="#a3a3a3")
        self.right_hand_cb.configure(foreground="#000000")
        self.right_hand_cb.configure(highlightbackground="#d9d9d9")
        self.right_hand_cb.configure(highlightcolor="black")
        self.right_hand_cb.configure(justify='left')
        self.right_hand_cb.configure(text='''Right Hand''')
        self.right_hand_cb.configure(variable=UI_v_203_support.rht_hnd)

        self.feet_cb = tk.Checkbutton(self.dataset_frame)
        self.feet_cb.place(relx=0.82, rely=0.27, relheight=0.168, relwidth=0.056)

        self.feet_cb.configure(activebackground="#ececec")
        self.feet_cb.configure(activeforeground="#000000")
        self.feet_cb.configure(background="#d9d9d9")
        self.feet_cb.configure(disabledforeground="#a3a3a3")
        self.feet_cb.configure(foreground="#000000")
        self.feet_cb.configure(highlightbackground="#d9d9d9")
        self.feet_cb.configure(highlightcolor="black")
        self.feet_cb.configure(justify='left')
        self.feet_cb.configure(text='''Feet''')
        self.feet_cb.configure(variable=UI_v_203_support.feet)

        self.tongue_cb = tk.Checkbutton(self.dataset_frame)
        self.tongue_cb.place(relx=0.898, rely=0.27, relheight=0.168
                , relwidth=0.077)
        self.tongue_cb.configure(activebackground="#ececec")
        self.tongue_cb.configure(activeforeground="#000000")
        self.tongue_cb.configure(background="#d9d9d9")
        self.tongue_cb.configure(disabledforeground="#a3a3a3")
        self.tongue_cb.configure(foreground="#000000")
        self.tongue_cb.configure(highlightbackground="#d9d9d9")
        self.tongue_cb.configure(highlightcolor="black")
        self.tongue_cb.configure(justify='left')
        self.tongue_cb.configure(text='''Tongue''')
        self.tongue_cb.configure(variable=UI_v_203_support.tng)


    def cf_lin_b_act(self,event=None):
        
        popup = tk.Toplevel()
        popup.geometry('576x432+250+100')
        
        self.Canvas1 = tk.Canvas(popup)
        self.Canvas1.place(relx=0.0, rely=0.0, height=576
                , width=576)
        clss.plot_confusion_matrix(cf_svm_lin,class_leb)
        
        self.img = cv2.imread('images/cf.png')
        self.img = cv2.resize(self.img, (576, 432)) 
        
        b,g,r = cv2.split(self.img)
        self.img = cv2.merge((r,g,b))
        
        self.im = Image.fromarray(self.img)
        self.imgtk = ImageTk.PhotoImage(image=self.im) 
        self.Canvas1.create_image(0, 0, anchor='nw', image=self.imgtk)        
        
        #tk.Label(popup, text=tem).grid(row=0,column=0)  
        #os.remove("images/cf.png")
    def cf_poli_b_act(self,event=None):
        
        clss.plot_confusion_matrix(cf_svm_poli,class_leb)
        

        popup = tk.Toplevel()
        popup.geometry('576x432+250+100')
        
        self.Canvas1 = tk.Canvas(popup)
        self.Canvas1.place(relx=0.0, rely=0.0, height=576
                , width=576)
        
        
        self.img = cv2.imread('images/cf.png')
        self.img = cv2.resize(self.img, (576, 432)) 
        
        b,g,r = cv2.split(self.img)
        self.img = cv2.merge((r,g,b))
        
        self.im = Image.fromarray(self.img)
        self.imgtk = ImageTk.PhotoImage(image=self.im) 
        self.Canvas1.create_image(0, 0, anchor='nw', image=self.imgtk) 
    def cf_rbf_b_act(self,event=None):
        clss.plot_confusion_matrix(cf_svm_rbf,class_leb)

        popup = tk.Toplevel()
        popup.geometry('576x432+250+100')
        
        self.Canvas1 = tk.Canvas(popup)
        self.Canvas1.place(relx=0.0, rely=0.0, height=576
                , width=576)
        
        
        self.img = cv2.imread('images/cf.png')
        self.img = cv2.resize(self.img, (576, 432)) 
        
        b,g,r = cv2.split(self.img)
        self.img = cv2.merge((r,g,b))
        
        self.im = Image.fromarray(self.img)
        self.imgtk = ImageTk.PhotoImage(image=self.im) 
        self.Canvas1.create_image(0, 0, anchor='nw', image=self.imgtk) 
                          
    def cf_rf_b_act(self,event=None):
        clss.plot_confusion_matrix(cf_rf,class_leb)
        

        popup = tk.Toplevel()
        popup.geometry('576x432+250+100')
        
        self.Canvas1 = tk.Canvas(popup)
        self.Canvas1.place(relx=0.0, rely=0.0, height=576
                , width=576)
        
        
        self.img = cv2.imread('images/cf.png')
        self.img = cv2.resize(self.img, (576, 432)) 
        
        b,g,r = cv2.split(self.img)
        self.img = cv2.merge((r,g,b))
        
        self.im = Image.fromarray(self.img)
        self.imgtk = ImageTk.PhotoImage(image=self.im) 
        self.Canvas1.create_image(0, 0, anchor='nw', image=self.imgtk) 
        
        


    def cf_lda_b_act(self,event=None):
        clss.plot_confusion_matrix(cf_lda,class_leb)
        

        popup = tk.Toplevel()
        popup.geometry('576x432+250+100')
        
        self.Canvas1 = tk.Canvas(popup)
        self.Canvas1.place(relx=0.0, rely=0.0, height=576
                , width=576)
        
        
        self.img = cv2.imread('images/cf.png')
        self.img = cv2.resize(self.img, (576, 432)) 
        
        b,g,r = cv2.split(self.img)
        self.img = cv2.merge((r,g,b))
        
        self.im = Image.fromarray(self.img)
        self.imgtk = ImageTk.PhotoImage(image=self.im) 
        self.Canvas1.create_image(0, 0, anchor='nw', image=self.imgtk) 
 

    def cf_cnn_b_act(self,event=None):
        clss.plot_confusion_matrix(cf_cnn,class_leb)
        

        popup = tk.Toplevel()
        popup.geometry('576x432+250+100')
        
        self.Canvas1 = tk.Canvas(popup)
        self.Canvas1.place(relx=0.0, rely=0.0, height=576
                , width=576)
        
        
        self.img = cv2.imread('images/cf.png')
        self.img = cv2.resize(self.img, (576, 432)) 
        
        b,g,r = cv2.split(self.img)
        self.img = cv2.merge((r,g,b))
        
        self.im = Image.fromarray(self.img)
        self.imgtk = ImageTk.PhotoImage(image=self.im) 
        self.Canvas1.create_image(0, 0, anchor='nw', image=self.imgtk) 

    def cf_dbn_b_act(self,event=None):
        clss.plot_confusion_matrix(cf_dbn,class_leb)
        
        popup = tk.Toplevel()
        popup.geometry('576x432+250+100')
        
        self.Canvas1 = tk.Canvas(popup)
        self.Canvas1.place(relx=0.0, rely=0.0, height=576
                , width=576)
        
        
        self.img = cv2.imread('images/cf.png')
        self.img = cv2.resize(self.img, (576, 432)) 
        
        b,g,r = cv2.split(self.img)
        self.img = cv2.merge((r,g,b))
        
        self.im = Image.fromarray(self.img)
        self.imgtk = ImageTk.PhotoImage(image=self.im) 
        self.Canvas1.create_image(0, 0, anchor='nw', image=self.imgtk) 

    def cf_ann_b_act(self,event=None):
        clss.plot_confusion_matrix(cf_ann,class_leb)
        
        popup = tk.Toplevel()
        popup.geometry('576x432+250+100')
        
        self.Canvas1 = tk.Canvas(popup)
        self.Canvas1.place(relx=0.0, rely=0.0, height=576
                , width=576)
        
        
        self.img = cv2.imread('images/cf.png')
        self.img = cv2.resize(self.img, (576, 432)) 
        
        b,g,r = cv2.split(self.img)
        self.img = cv2.merge((r,g,b))
        
        self.im = Image.fromarray(self.img)
        self.imgtk = ImageTk.PhotoImage(image=self.im) 
        self.Canvas1.create_image(0, 0, anchor='nw', image=self.imgtk) 


    def cf_knn_b_act(self,event=None):
        clss.plot_confusion_matrix(cf_knn,class_leb)
        
        popup = tk.Toplevel()
        popup.geometry('576x432+250+100')
        
        self.Canvas1 = tk.Canvas(popup)
        self.Canvas1.place(relx=0.0, rely=0.0, height=576
                , width=576)
        
        
        self.img = cv2.imread('images/cf.png')
        self.img = cv2.resize(self.img, (576, 432)) 
        
        b,g,r = cv2.split(self.img)
        self.img = cv2.merge((r,g,b))
        
        self.im = Image.fromarray(self.img)
        self.imgtk = ImageTk.PhotoImage(image=self.im) 
        self.Canvas1.create_image(0, 0, anchor='nw', image=self.imgtk) 

          
    def execute(self,event=None):
        #self.wrt_options()
        file='images/selected_Channels.txt'
        global ch_list
        global cf_ann,cf_cnn,cf_dbn,cf_knn,cf_lda,cf_rf,cf_svm_lin,cf_svm_poli,cf_svm_rbf

        if (UI_v_203_support.all_sel.get()==1):
            with open(file) as f:
                content = f.readlines()
            # you may also want to remove whitespace characters like `\n` at the end of each line
            content = [x.strip() for x in content]
            
            ch_list = np.array(content)
            
            ch_list=np.where(ch_list=='1')
            ch_list=ch_list[0]
            #os.remove("images/selected_Channels.txt")
        else:
            ch_list=np.arange(0,22,1)
        
        if(UI_v_203_support.is_keppa.get()==1):
            self.Label5 = tk.Label(self.report_frame)
            self.Label5.place(relx=0.710, rely=0.180, height=20, width=100)
            self.Label5.configure(activebackground="#f9f9f9")
            self.Label5.configure(activeforeground="black")
            self.Label5.configure(background="#d1b9f9")
            self.Label5.configure(disabledforeground="#a3a3a3")
            self.Label5.configure(foreground="#000000")
            self.Label5.configure(highlightbackground="#d9d9d9")
            self.Label5.configure(highlightcolor="black")
            self.Label5.configure(text='''Kappa Score''')
            
            self.Label5 = tk.Label(self.report_frame)
            self.Label5.place(relx=0.200, rely=0.180, height=20, width=100)
            self.Label5.configure(activebackground="#f9f9f9")
            self.Label5.configure(activeforeground="black")
            self.Label5.configure(background="#d1b9f9")
            self.Label5.configure(disabledforeground="#a3a3a3")
            self.Label5.configure(foreground="#000000")
            self.Label5.configure(highlightbackground="#d9d9d9")
            self.Label5.configure(highlightcolor="black")
            self.Label5.configure(text='''Kappa Score''')
        else:
            self.Label5 = tk.Label(self.report_frame)
            self.Label5.place(relx=0.710, rely=0.180, height=20, width=100)
            self.Label5.configure(activebackground="#f9f9f9")
            self.Label5.configure(activeforeground="black")
            self.Label5.configure(background="#d1b9f9")
            self.Label5.configure(disabledforeground="#a3a3a3")
            self.Label5.configure(foreground="#000000")
            self.Label5.configure(highlightbackground="#d9d9d9")
            self.Label5.configure(highlightcolor="black")
            self.Label5.configure(text='''Accuracy(%)''')
            
            self.Label5 = tk.Label(self.report_frame)
            self.Label5.place(relx=0.200, rely=0.180, height=20, width=100)
            self.Label5.configure(activebackground="#f9f9f9")
            self.Label5.configure(activeforeground="black")
            self.Label5.configure(background="#d1b9f9")
            self.Label5.configure(disabledforeground="#a3a3a3")
            self.Label5.configure(foreground="#000000")
            self.Label5.configure(highlightbackground="#d9d9d9")
            self.Label5.configure(highlightcolor="black")
            self.Label5.configure(text='''Accuracy(%)''') 
        
        self.get_entries()
        global class_leb
        class_leb=np.where(classes==1)
        class_leb=class_leb[0]
        class_leb +=1
        
        if(n_comp<n_feat or n_comp>22):
            messagebox.showerror("Error","The Number of component has to be larger than the number of feature and less then the number of channels" )
            return
        self.clr_res()
  
        try:
            popup = tk.Toplevel()
            popup.geometry('300x80+600+300')
            tk.Label(popup, text="Please Wait ").grid(row=0,column=0)
    
    
            progress_bar = ttk.Progressbar(popup, length=300,mode='determinate')
            progress_bar.grid(row=1, column=0)#.pack(fill=tk.X, expand=1, side=tk.BOTTOM)
    
            l2=tk.Label(popup, text="Current Task: Preprocessing ")
            l2.grid(row=2,column=0)
            popup.update()
            
            ##progress_bar.step()
    
            k=clss

            
            ft_alt,Y,ft_T_alt,Y_test,class_no,size,channel = k.preprocess_data(train_path, test_path,is_cheby,l,h,ordd,fs,
                                                         n_comp,n_feat,classes,ch_list)


            ##############################################################################
            l2.grid_forget()
            l2=tk.Label(popup, text="Current Task: KNN classification ")
            l2.grid(row=2,column=0)
            progress_bar['value'] +=10
            popup.update()
            if(UI_v_203_support.knn.get()==1):
                res_knn,cf_knn=k.cls_knn(ft_alt,Y,ft_T_alt,Y_test,
                            UI_v_203_support.is_keppa.get())
                self.knn_res.insert(tk.END,res_knn)
                self.cf_knn_b = tk.Button(self.report_frame)
                self.cf_knn_b.place(relx=0.820, rely=0.729, height=23, width=110)
                self.cf_knn_b.configure(activebackground="#ececec")
                self.cf_knn_b.configure(activeforeground="#000000")
                self.cf_knn_b.configure(background="#d9d9d9")
                self.cf_knn_b.configure(disabledforeground="#a3a3a3")
                self.cf_knn_b.configure(foreground="#000000")
                self.cf_knn_b.configure(highlightbackground="#d9d9d9")
                self.cf_knn_b.configure(highlightcolor="black")
                self.cf_knn_b.configure(pady="0")
                self.cf_knn_b.configure(text='''Confusion Matrix''')
                self.cf_knn_b.configure(command=self.cf_knn_b_act)
                
                
            ###########################################################################
            l2.grid_forget()  
            l2=tk.Label(popup, text="Current Task: Random forest classification ")
            l2.grid(row=2,column=0)
            progress_bar['value'] +=10
            popup.update()
    
            if(UI_v_203_support.rf.get()==1):
                res_rf,cf_rf=k.cls_rf(ft_alt,Y,ft_T_alt,Y_test,
                            UI_v_203_support.is_keppa.get())
                self.rf_res.insert(tk.END,res_rf)
                self.cf_rf_b = tk.Button(self.report_frame)
                self.cf_rf_b.place(relx=0.310, rely=0.869, height=23, width=110)
                self.cf_rf_b.configure(activebackground="#ececec")
                self.cf_rf_b.configure(activeforeground="#000000")
                self.cf_rf_b.configure(background="#d9d9d9")
                self.cf_rf_b.configure(disabledforeground="#a3a3a3")
                self.cf_rf_b.configure(foreground="#000000")
                self.cf_rf_b.configure(highlightbackground="#d9d9d9")
                self.cf_rf_b.configure(highlightcolor="black")
                self.cf_rf_b.configure(pady="0")
                self.cf_rf_b.configure(text='''Confusion Matrix''')
                self.cf_rf_b.configure(command=self.cf_rf_b_act)
            
            ###########################################################################
            l2.grid_forget()
            l2=tk.Label(popup, text="Current Task: LDA classification ")
            l2.grid(row=2,column=0)
            progress_bar['value'] +=10
            popup.update()
    
            if(UI_v_203_support.lda.get()==1):
                res_lda,cf_lda=k.cls_lda(ft_alt,Y,ft_T_alt,Y_test,
                            UI_v_203_support.is_keppa.get())
                self.lda_res.insert(tk.END,res_lda)
                self.cf_lda_b = tk.Button(self.report_frame)
                self.cf_lda_b.place(relx=0.310, rely=0.717, height=23, width=110)
                self.cf_lda_b.configure(activebackground="#ececec")
                self.cf_lda_b.configure(activeforeground="#000000")
                self.cf_lda_b.configure(background="#d9d9d9")
                self.cf_lda_b.configure(disabledforeground="#a3a3a3")
                self.cf_lda_b.configure(foreground="#000000")
                self.cf_lda_b.configure(highlightbackground="#d9d9d9")
                self.cf_lda_b.configure(highlightcolor="black")
                self.cf_lda_b.configure(pady="0")
                self.cf_lda_b.configure(text='''Confusion Matrix''')
                self.cf_lda_b.configure(command=self.cf_lda_b_act)
            ###########################################################################    
            l2.grid_forget()
            l2=tk.Label(popup, text="Current Task: SVM(LIN) classification ")
            l2.grid(row=2,column=0)
            progress_bar['value'] +=10
            popup.update()
      
            if(UI_v_203_support.svm_lin.get()==1):
                res_svm_lin,cf_svm_lin=k.cls_svm_lin(ft_alt,Y,ft_T_alt,Y_test,
                            UI_v_203_support.is_keppa.get())
                self.svm_lin_res.insert(tk.END,res_svm_lin)
            
                self.cf_lin_b = tk.Button(self.report_frame)
                self.cf_lin_b.place(relx=0.820, rely=0.577, height=23, width=110)
                self.cf_lin_b.configure(activebackground="#ececec")
                self.cf_lin_b.configure(activeforeground="#000000")
                self.cf_lin_b.configure(background="#d9d9d9")
                self.cf_lin_b.configure(disabledforeground="#a3a3a3")
                self.cf_lin_b.configure(foreground="#000000")
                self.cf_lin_b.configure(highlightbackground="#d9d9d9")
                self.cf_lin_b.configure(highlightcolor="black")
                self.cf_lin_b.configure(pady="0")
                self.cf_lin_b.configure(text='''Confusion Matrix''')
                self.cf_lin_b.configure(command=self.cf_lin_b_act)
                
        
          ###########################################################################
            l2.grid_forget()
            l2=tk.Label(popup, text="Current Task: SVM(Poli) classification ")
            l2.grid(row=2,column=0)
            progress_bar['value'] +=10
            popup.update()
        
            if(UI_v_203_support.svm_poli.get()==1):
                res_svm_poli,cf_svm_poli=k.cls_svm_poli(ft_alt,Y,ft_T_alt,Y_test,
                            UI_v_203_support.is_keppa.get())
                
                self.svm_poli_res.insert(tk.END,res_svm_poli)
                
                self.cf_poli_b = tk.Button(self.report_frame)
                self.cf_poli_b.place(relx=0.820, rely=0.44, height=23, width=110)
                self.cf_poli_b.configure(activebackground="#ececec")
                self.cf_poli_b.configure(activeforeground="#000000")
                self.cf_poli_b.configure(background="#d9d9d9")
                self.cf_poli_b.configure(disabledforeground="#a3a3a3")
                self.cf_poli_b.configure(foreground="#000000")
                self.cf_poli_b.configure(highlightbackground="#d9d9d9")
                self.cf_poli_b.configure(highlightcolor="black")
                self.cf_poli_b.configure(pady="0")
                self.cf_poli_b.configure(text='''Confusion Matrix''')
                self.cf_poli_b.configure(command=self.cf_poli_b_act)   
                
                
            l2.grid_forget()
            l2=tk.Label(popup, text="Current Task: SVM(RBF) classification ")
            l2.grid(row=2,column=0)
            progress_bar['value'] +=10
            popup.update()
       
            if(UI_v_203_support.svm_rbf.get()==1):
                res_svm_rbf,cf_svm_rbf =k.cls_svm_rbf(ft_alt,Y,ft_T_alt,Y_test,
                            UI_v_203_support.is_keppa.get())
                
                self.svm_rbf_res.insert(tk.END,res_svm_rbf)
                self.cf_rbf_b = tk.Button(self.report_frame)
                self.cf_rbf_b.place(relx=0.820, rely=0.306, height=23, width=110)
                self.cf_rbf_b.configure(activebackground="#ececec")
                self.cf_rbf_b.configure(activeforeground="#000000")
                self.cf_rbf_b.configure(background="#d9d9d9")
                self.cf_rbf_b.configure(disabledforeground="#a3a3a3")
                self.cf_rbf_b.configure(foreground="#000000")
                self.cf_rbf_b.configure(highlightbackground="#d9d9d9")
                self.cf_rbf_b.configure(highlightcolor="black")
                self.cf_rbf_b.configure(pady="0")
                self.cf_rbf_b.configure(text='''Confusion Matrix''')
                self.cf_rbf_b.configure(command=self.cf_rbf_b_act)
            ####################################################################
            l2.grid_forget()
            l2=tk.Label(popup, text="Current Task: ANN classification ")
            l2.grid(row=2,column=0)
            progress_bar['value'] +=10
            popup.update()
        
            if(UI_v_203_support.ann.get()==1):
                res_ann,cf_ann=k.cls_ann(ft_alt,Y,ft_T_alt,Y_test,
                            UI_v_203_support.is_keppa.get())
                self.ann_res.insert(tk.END,res_ann)
                
                self.cf_ann_b = tk.Button(self.report_frame)
                self.cf_ann_b.place(relx=0.310, rely=0.44, height=23, width=110)
                self.cf_ann_b.configure(activebackground="#ececec")
                self.cf_ann_b.configure(activeforeground="#000000")
                self.cf_ann_b.configure(background="#d9d9d9")
                self.cf_ann_b.configure(disabledforeground="#a3a3a3")
                self.cf_ann_b.configure(foreground="#000000")
                self.cf_ann_b.configure(highlightbackground="#d9d9d9")
                self.cf_ann_b.configure(highlightcolor="black")
                self.cf_ann_b.configure(pady="0")
                self.cf_ann_b.configure(text='''Confusion Matrix''')
                self.cf_ann_b.configure(command=self.cf_ann_b_act)

                
            l2.grid_forget()
            l2=tk.Label(popup, text="Current Task: DBN classification ")
            l2.grid(row=2,column=0)
            progress_bar['value'] +=10
            popup.update()         
            
            if(UI_v_203_support.dbn.get()==1):
                res_dbn,cf_dbn=k.cls_dbn(ft_alt,Y,ft_T_alt,Y_test,
                            UI_v_203_support.is_keppa.get())        #call dbn
                self.dbn_res.insert(tk.END,res_dbn)
                
                self.cf_dbn_b = tk.Button(self.report_frame)
                self.cf_dbn_b.place(relx=0.310, rely=0.573, height=23, width=110)
                self.cf_dbn_b.configure(activebackground="#ececec")
                self.cf_dbn_b.configure(activeforeground="#000000")
                self.cf_dbn_b.configure(background="#d9d9d9")
                self.cf_dbn_b.configure(disabledforeground="#a3a3a3")
                self.cf_dbn_b.configure(foreground="#000000")
                self.cf_dbn_b.configure(highlightbackground="#d9d9d9")
                self.cf_dbn_b.configure(highlightcolor="black")
                self.cf_dbn_b.configure(pady="0")
                self.cf_dbn_b.configure(text='''Confusion Matrix''')
                self.cf_dbn_b.configure(command=self.cf_dbn_b_act)
                
            l2.grid_forget()
            l2=tk.Label(popup, text="Current Task: CNN classification ")
            l2.grid(row=2,column=0)
            progress_bar['value'] +=10
            popup.update()
            if(UI_v_203_support.cnn.get()==1):
                q=clss
                res_cnn,cf_cnn=q.cls_cnn(train_path, test_path,is_cheby,l,h,ordd,fs,n_comp,n_feat,
                            UI_v_203_support.is_keppa.get(),classes,ch_list)
                self.cnn_res.insert(tk.END,res_cnn)
                
                self.cf_cnn_b = tk.Button(self.report_frame)
                self.cf_cnn_b.place(relx=0.310, rely=0.306, height=23, width=110)
                self.cf_cnn_b.configure(activebackground="#ececec")
                self.cf_cnn_b.configure(activeforeground="#000000")
                self.cf_cnn_b.configure(background="#d9d9d9")
                self.cf_cnn_b.configure(disabledforeground="#a3a3a3")
                self.cf_cnn_b.configure(foreground="#000000")
                self.cf_cnn_b.configure(highlightbackground="#d9d9d9")
                self.cf_cnn_b.configure(highlightcolor="black")
                self.cf_cnn_b.configure(pady="0")
                self.cf_cnn_b.configure(text='''Confusion Matrix''')
                self.cf_cnn_b.configure(command=self.cf_cnn_b_act)

    
            popup.update()
    
            popup.destroy()
            # if os.path.exists("images/selected_Channels.txt"):
            #     os.remove("images/selected_Channels.txt")
            class_no = 4 - class_no
    
            strr="The classifiers has been trained and tested with "+str(size)+" samples of "+str(class_no)+" class and "+str(channel)+" channels"
    
            messagebox.showinfo("Output",strr )

        except Exception as e:
            print(e)
            messagebox.showerror("Error","An error has occured. Recheck the inputss" )

    def get_entries(self):
        global fs,l,h,ordd,n_comp,n_feat,train_path,test_path,is_cheby,classes
        try:
            train_path= str(self.path_traiin.get("1.0",'end-1c'))
            test_path = str(self.path_test.get("1.0",'end-1c'))
            is_cheby = int(UI_v_203_support.bandpass_cheby.get())
            
            fs=int(self.fs.get())
            l=int(self.lowcut.get())
            h=int(self.highcut.get())
            ordd=int(self.ord.get())
            
            n_comp=int(self.n_cmp.get())
            n_feat= int(self.n_ft.get())
            if(UI_v_203_support.auto_task_selection.get()==1):
                classes=np.array([UI_v_203_support.lf_hnd.get(),
                                  UI_v_203_support.rht_hnd.get(),
                                  UI_v_203_support.feet.get(),
                                  UI_v_203_support.tng.get()])
            else:
                classes=np.array([1,1,1,1])
        except:
            messagebox.showerror("Attention","Please fill out all the sections" )

        
    def popup_open(self):
        UI_Final_year_v202_popup.create_Toplevel1(root)
        file='images/selected_Channels.txt'
        with open(file) as f:
            content = f.readlines()
        # you may also want to remove whitespace characters like `\n` at the end of each line
        content = [x.strip() for x in content]
        global ch_list
        ch_list = np.array(content)
        
        ch_list=np.where(ch_list=='1')
        ch_list=ch_list[0]
        
    def clr_res(self):
        self.knn_res.delete('1.0', 'end')
        self.rf_res.delete('1.0', 'end')
        self.lda_res.delete('1.0', 'end')
        
        self.svm_lin_res.delete('1.0', 'end')
        self.svm_poli_res.delete('1.0', 'end')
        self.svm_rbf_res.delete('1.0', 'end')
        
        self.cnn_res.delete('1.0', 'end')
        self.ann_res.delete('1.0', 'end')
        self.dbn_res.delete('1.0', 'end')
        
    def set_Tk_val(self,event=None):
        UI_v_203_support.lf_hnd.set(0)
        UI_v_203_support.rht_hnd.set(0)
        UI_v_203_support.feet.set(0)
        UI_v_203_support.tng.set(0)
        #################################
        UI_v_203_support.auto_task_selection.set(0)
        ##############################
        UI_v_203_support.cnn.set(0)
        UI_v_203_support.ann.set(0)
        UI_v_203_support.dbn.set(0)
        UI_v_203_support.knn.set(0) 
        UI_v_203_support.lda.set(0) 
        UI_v_203_support.rf.set(0)
        UI_v_203_support.svm_lin.set(0)
        UI_v_203_support.svm_poli.set(0)
        UI_v_203_support.svm_rbf.set(0)
        UI_v_203_support.bandpass_cheby.set(0)
        UI_v_203_support.is_keppa.set(0)
        UI_v_203_support.all_sel.set(0)
        #########################################
        self.lowcut.delete(0, 'end')
        self.highcut.delete(0, 'end')
        self.ord.delete(0, 'end')
        self.fs.delete(0, 'end')
        
        self.n_cmp.delete(0, 'end')
        self.n_ft.delete(0, 'end')
        
        self.path_traiin.delete('1.0', 'end')
        self.path_test.delete('1.0', 'end')
        
        self.clr_res()
     
        
    def folder_sel(self):
        self.path_traiin.delete('1.0', 'end')
        root.filename =  filedialog.askopenfilename(initialdir = "/",title = 
        "Select Folder",filetypes = (("Matlab Matrix files","*.mat"),("all files","*.*"),
                                     ("EDF files","*.edf")))
        path=root.filename
        print(path)
        self.path_traiin.insert(tk.END,path)
        
    def folder_sel_2(self):
        self.path_test.delete('1.0', 'end')
        root.filename =  filedialog.askopenfilename(initialdir = "/",title = 
        "Select Folder",filetypes = (("Matlab Matrix files","*.mat"),("all files","*.*"),
                                     ("EDF files","*.edf")))
        path=root.filename
        print(path)
        self.path_test.insert(tk.END,path)
#%%
    def __init__(self, top=None):
        '''This class configures and populates the toplevel window.
           top is the toplevel containing window.'''
        UI_v_203_support.set_Tk_var()
        _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)])

        top.geometry("1089x785+275+0")
        top.minsize(148, 1)
        top.maxsize(1924, 1055)
        top.resizable(1, 1)
        top.title("Motor imagery Classifier")
        top.configure(borderwidth="2")
        top.configure(background="#d9d9d9")
        top.configure(highlightbackground="#d9d9d9")
        top.configure(highlightcolor="black")
        
        p1 = ImageTk.PhotoImage(file = 'images/icon.png')
        top.iconphoto(False, p1)
        
#%%                                                                             Heading
        self.Label1 = tk.Label(top)
        self.Label1.place(relx=0.303, rely=0.0, height=46, width=492)
        self.Label1.configure(activebackground="#f9f9f9")
        self.Label1.configure(activeforeground="#000000")
        self.Label1.configure(background="#b9bef9")
        self.Label1.configure(disabledforeground="#a3a3a3")
        self.Label1.configure(font="-family {Segoe UI} -size 13 -weight bold")
        self.Label1.configure(foreground="#000000")
        self.Label1.configure(highlightbackground="#d9d9d9")
        self.Label1.configure(highlightcolor="black")
        self.Label1.configure(text='''Motor Imagery Classifier''')
#%%                                                                             Reset and run_all      
        self.reset_all = tk.Button(top)
        self.reset_all.place(relx=0.275, rely=0.918, height=53, width=206)
        self.reset_all.configure(activebackground="#ececec")
        self.reset_all.configure(activeforeground="#000000")
        self.reset_all.configure(background="#fd465e")
        self.reset_all.configure(disabledforeground="#a3a3a3")
        self.reset_all.configure(font="-family {Segoe UI} -size 12 -weight bold")
        self.reset_all.configure(foreground="#000000")
        self.reset_all.configure(highlightbackground="#ffffff")
        self.reset_all.configure(highlightcolor="black")
        self.reset_all.configure(pady="0")
        self.reset_all.configure(text='''RESET''')
        self.reset_all.bind("<Button-1>",self.set_Tk_val)
        
        self.run_all = tk.Button(top)
        self.run_all.place(relx=0.579, rely=0.918, height=53, width=206)
        self.run_all.configure(activebackground="#ececec")
        self.run_all.configure(activeforeground="#000000")
        self.run_all.configure(background="#00ff40")
        self.run_all.configure(disabledforeground="#a3a3a3")
        self.run_all.configure(font="-family {Segoe UI} -size 12 -weight bold")
        self.run_all.configure(foreground="#000000")
        self.run_all.configure(highlightbackground="#ffffff")
        self.run_all.configure(highlightcolor="black")
        self.run_all.configure(pady="0")
        self.run_all.configure(text='''Execute''')
        self.run_all.bind("<Button-1>",self.execute)
#%%                                                                             All frames 
        """Dataset"""
        self.dataset_frame = tk.Frame(top)
        self.dataset_frame.place(relx=0.028, rely=0.060, relheight=0.239
                , relwidth=0.941)
        self.dataset_frame.configure(relief='groove')
        self.dataset_frame.configure(borderwidth="2")
        self.dataset_frame.configure(relief="groove")
        self.dataset_frame.configure(background="#d9d9d9")
        self.dataset_frame.configure(highlightbackground="#d9d9d9")
        self.dataset_frame.configure(highlightcolor="black")
        
        """Channel Select 323"""
        self.channel_select = tk.Frame(top)
        self.channel_select.place(relx=0.523, rely=0.305, relheight=0.123
                , relwidth=0.445)
        self.channel_select.configure(relief='groove')
        self.channel_select.configure(borderwidth="2")
        self.channel_select.configure(relief="groove")
        self.channel_select.configure(background="#d9d9d9")
        self.channel_select.configure(cursor="fleur")
        self.channel_select.configure(highlightbackground="#d9d9d9")
        self.channel_select.configure(highlightcolor="black")
        
        """"REport Frame"""
        self.report_frame = tk.Frame(top)
        self.report_frame.place(relx=0.028, rely=0.625, relheight=0.280
                , relwidth=0.941)
        self.report_frame.configure(relief='groove')
        self.report_frame.configure(borderwidth="2")
        self.report_frame.configure(relief="groove")
        self.report_frame.configure(background="#d9d9d9")
        self.report_frame.configure(highlightbackground="#0f0f0f")
        self.report_frame.configure(highlightcolor="black")
        
        """"Bandpass filter Frame"""
        self.bandpass_frame = tk.Frame(top)
        self.bandpass_frame.place(relx=0.028, rely=0.305, relheight=0.213
                , relwidth=0.473)
        self.bandpass_frame.configure(relief='groove')
        self.bandpass_frame.configure(borderwidth="2")
        self.bandpass_frame.configure(relief="groove")
        self.bandpass_frame.configure(background="#d9d9d9")
        self.bandpass_frame.configure(highlightbackground="#d9d9d9")
        self.bandpass_frame.configure(highlightcolor="black")
        
        """ Feature frame """
        self.feature_frame = tk.Frame(top)
        self.feature_frame.place(relx=0.523, rely=0.433, relheight=0.188
                , relwidth=0.445)
        self.feature_frame.configure(relief='groove')
        self.feature_frame.configure(borderwidth="2")
        self.feature_frame.configure(relief="groove")
        self.feature_frame.configure(background="#d9d9d9")
        self.feature_frame.configure(highlightbackground="#d9d9d9")
        self.feature_frame.configure(highlightcolor="black")
        
        """Metric Frame"""
        self.metric_frame = tk.Frame(top)
        self.metric_frame.place(relx=0.028, rely=0.523, relheight=0.097
                , relwidth=0.473)
        self.metric_frame.configure(relief='groove')
        self.metric_frame.configure(borderwidth="2")
        self.metric_frame.configure(relief="groove")
        self.metric_frame.configure(background="#d9d9d9")
        self.metric_frame.configure(cursor="fleur")
        self.metric_frame.configure(highlightbackground="#d9d9d9")
        self.metric_frame.configure(highlightcolor="black")
################################################################################ labels 
#%%   """Lebels & texts"""#######################################               Dataset Frame
        self.Label2 = tk.Label(self.dataset_frame)
        self.Label2.place(relx=-0.039, rely=0.054, height=26, width=1115)
        self.Label2.configure(activebackground="#f9f9f9")
        self.Label2.configure(activeforeground="black")
        self.Label2.configure(background="#c6bff2")
        self.Label2.configure(disabledforeground="#a3a3a3")
        self.Label2.configure(font="-family {Segoe UI} -size 9 -weight bold")
        self.Label2.configure(foreground="#000000")
        self.Label2.configure(highlightbackground="#d9d9d9")
        self.Label2.configure(highlightcolor="black")
        self.Label2.configure(text='''Dataset Spacifications''')
        
        self.Label5 = tk.Label(self.dataset_frame)
        self.Label5.place(relx=0.02, rely=0.486, height=26, width=115)
        self.Label5.configure(activebackground="#f9f9f9")
        self.Label5.configure(activeforeground="black")
        self.Label5.configure(background="#d1b9f9")
        self.Label5.configure(disabledforeground="#a3a3a3")
        self.Label5.configure(foreground="#000000")
        self.Label5.configure(highlightbackground="#d9d9d9")
        self.Label5.configure(highlightcolor="black")
        self.Label5.configure(text='''Training dataset path''')
        
        self.Label7 = tk.Label(self.dataset_frame)
        self.Label7.place(relx=0.670, rely=0.486, height=26, width=115)
        self.Label7.configure(activebackground="#f9f9f9")
        self.Label7.configure(activeforeground="black")
        self.Label7.configure(background="#d1b9f9")
        self.Label7.configure(disabledforeground="#a3a3a3")
        self.Label7.configure(foreground="#000000")
        self.Label7.configure(highlightbackground="#d9d9d9")
        self.Label7.configure(highlightcolor="black")
        self.Label7.configure(text='''Dataset File Format''')

        self.Label3 = tk.Label(self.dataset_frame)
        self.Label3.place(relx=0.02, rely=0.27, height=26, width=142)
        self.Label3.configure(activebackground="#f9f9f9")
        self.Label3.configure(activeforeground="black")
        self.Label3.configure(background="#d1b9f9")
        self.Label3.configure(disabledforeground="#a3a3a3")
        self.Label3.configure(foreground="#000000")
        self.Label3.configure(highlightbackground="#d9d9d9")
        self.Label3.configure(highlightcolor="black")
        self.Label3.configure(text='''Task list collection''')

        self.Label5_3 = tk.Label(self.dataset_frame)
        self.Label5_3.place(relx=0.02, rely=0.757, height=26, width=125)
        self.Label5_3.configure(activebackground="#f9f9f9")
        self.Label5_3.configure(activeforeground="black")
        self.Label5_3.configure(background="#d1b9f9")
        self.Label5_3.configure(disabledforeground="#a3a3a3")
        self.Label5_3.configure(foreground="#000000")
        self.Label5_3.configure(highlightbackground="#d9d9d9")
        self.Label5_3.configure(highlightcolor="black")
        self.Label5_3.configure(text='''Evaluation dataset path''') 
        
        self.Label7_6 = tk.Label(self.dataset_frame)
        self.Label7_6.place(relx=0.670, rely=0.757, height=26, width=115)
        self.Label7_6.configure(activebackground="#f9f9f9")
        self.Label7_6.configure(activeforeground="black")
        self.Label7_6.configure(background="#d1b9f9")
        self.Label7_6.configure(disabledforeground="#a3a3a3")
        self.Label7_6.configure(foreground="#000000")
        self.Label7_6.configure(highlightbackground="#d9d9d9")
        self.Label7_6.configure(highlightcolor="black")
        self.Label7_6.configure(text='''Dataset File Format''')  
##############################################################################  
        
        """Channel Selection """
        self.Label4 = tk.Label(self.channel_select)
        self.Label4.place(relx=-0.041, rely=0.105, height=26, width=512)
        self.Label4.configure(activebackground="#f9f9f9")
        self.Label4.configure(activeforeground="black")
        self.Label4.configure(background="#c6bff2")
        self.Label4.configure(disabledforeground="#a3a3a3")
        self.Label4.configure(font="-family {Segoe UI} -size 9 -weight bold")
        self.Label4.configure(foreground="#000000")
        self.Label4.configure(highlightbackground="#d9d9d9")
        self.Label4.configure(highlightcolor="#646464646464")
        self.Label4.configure(text='''Channel Selection''')
       
##############################################################################
        """Classifiaction report"""
        self.Label8 = tk.Label(self.report_frame)
        self.Label8.place(relx=-0.039, rely=0.03, height=30, width=1110)
        self.Label8.configure(activebackground="#f9f9f9")
        self.Label8.configure(activeforeground="black")
        self.Label8.configure(background="#c6bff2")
        self.Label8.configure(disabledforeground="#a3a3a3")
        self.Label8.configure(font="-family {Segoe UI} -size 9 -weight bold")
        self.Label8.configure(foreground="#000000")
        self.Label8.configure(highlightbackground="#d9d9d9")
        self.Label8.configure(highlightcolor="black")
        self.Label8.configure(text='''Classification Report''')    
        
        
##############################################################################
        """"Bandpass filter""" 
        
        self.Label4_10 = tk.Label(self.bandpass_frame)
        self.Label4_10.place(relx=0.0, rely=0.061, height=26, width=522)
        self.Label4_10.configure(activebackground="#f9f9f9")
        self.Label4_10.configure(activeforeground="black")
        self.Label4_10.configure(background="#c6bff2")
        self.Label4_10.configure(disabledforeground="#a3a3a3")
        self.Label4_10.configure(font="-family {Segoe UI} -size 9 -weight bold")
        self.Label4_10.configure(foreground="#000000")
        self.Label4_10.configure(highlightbackground="#d9d9d9")
        self.Label4_10.configure(highlightcolor="#646464646464")
        self.Label4_10.configure(text='''Bandpasss filter''')

        self.Label5_12 = tk.Label(self.bandpass_frame)
        self.Label5_12.place(relx=0.039, rely=0.303, height=26, width=121)
        self.Label5_12.configure(activebackground="#f9f9f9")
        self.Label5_12.configure(activeforeground="black")
        self.Label5_12.configure(background="#d1b9f9")
        self.Label5_12.configure(disabledforeground="#a3a3a3")
        self.Label5_12.configure(foreground="#000000")
        self.Label5_12.configure(highlightbackground="#d9d9d9")
        self.Label5_12.configure(highlightcolor="black")
        self.Label5_12.configure(text='''Type of filter''')

        self.Label5_13 = tk.Label(self.bandpass_frame)
        self.Label5_13.place(relx=0.039, rely=0.545, height=26, width=111)
        self.Label5_13.configure(activebackground="#f9f9f9")
        self.Label5_13.configure(activeforeground="black")
        self.Label5_13.configure(background="#d1b9f9")
        self.Label5_13.configure(disabledforeground="#a3a3a3")
        self.Label5_13.configure(foreground="#000000")
        self.Label5_13.configure(highlightbackground="#d9d9d9")
        self.Label5_13.configure(highlightcolor="black")
        self.Label5_13.configure(text='''Lowcut (Hz)''')

        self.Label5_14 = tk.Label(self.bandpass_frame)
        self.Label5_14.place(relx=0.583, rely=0.545, height=26, width=111)
        self.Label5_14.configure(activebackground="#f9f9f9")
        self.Label5_14.configure(activeforeground="black")
        self.Label5_14.configure(background="#d1b9f9")
        self.Label5_14.configure(disabledforeground="#a3a3a3")
        self.Label5_14.configure(foreground="#000000")
        self.Label5_14.configure(highlightbackground="#d9d9d9")
        self.Label5_14.configure(highlightcolor="black")
        self.Label5_14.configure(text='''Highpass (Hz)''')

        self.Label5_5 = tk.Label(self.bandpass_frame)
        self.Label5_5.place(relx=0.039, rely=0.788, height=26, width=81)
        self.Label5_5.configure(activebackground="#f9f9f9")
        self.Label5_5.configure(activeforeground="black")
        self.Label5_5.configure(background="#d1b9f9")
        self.Label5_5.configure(disabledforeground="#a3a3a3")
        self.Label5_5.configure(foreground="#000000")
        self.Label5_5.configure(highlightbackground="#d9d9d9")
        self.Label5_5.configure(highlightcolor="black")
        self.Label5_5.configure(text='''Order''')
        
        self.Label5_17 = tk.Label(self.bandpass_frame)
        self.Label5_17.place(relx=0.466, rely=0.788, height=26, width=171)
        self.Label5_17.configure(activebackground="#f9f9f9")
        self.Label5_17.configure(activeforeground="black")
        self.Label5_17.configure(background="#d1b9f9")
        self.Label5_17.configure(disabledforeground="#a3a3a3")
        self.Label5_17.configure(foreground="#000000")
        self.Label5_17.configure(highlightbackground="#d9d9d9")
        self.Label5_17.configure(highlightcolor="black")
        self.Label5_17.configure(text='''Sampling Frequency(Hz)''')
##############################################################################
        """Metric"""
        self.Label4_12 = tk.Label(self.metric_frame)
        self.Label4_12.place(relx=-0.019, rely=0.133, height=26, width=522)
        self.Label4_12.configure(activebackground="#f9f9f9")
        self.Label4_12.configure(activeforeground="black")
        self.Label4_12.configure(background="#c6bff2")
        self.Label4_12.configure(disabledforeground="#a3a3a3")
        self.Label4_12.configure(font="-family {Segoe UI} -size 9 -weight bold")
        self.Label4_12.configure(foreground="#000000")
        self.Label4_12.configure(highlightbackground="#d9d9d9")
        self.Label4_12.configure(highlightcolor="#646464646464")
        self.Label4_12.configure(text='''Classfication Metric''')


##############################################################################
        """Feature Frame"""
        self.Label4_11 = tk.Label(self.feature_frame)
        self.Label4_11.place(relx=-0.062, rely=0.069, height=26, width=522)
        self.Label4_11.configure(activebackground="#f9f9f9")
        self.Label4_11.configure(activeforeground="black")
        self.Label4_11.configure(background="#c6bff2")
        self.Label4_11.configure(disabledforeground="#a3a3a3")
        self.Label4_11.configure(font="-family {Segoe UI} -size 9 -weight bold")
        self.Label4_11.configure(foreground="#000000")
        self.Label4_11.configure(highlightbackground="#d9d9d9")
        self.Label4_11.configure(highlightcolor="#646464646464")
        self.Label4_11.configure(text='''Feature Extraction (CSP)''')

        self.Label5_14 = tk.Label(self.feature_frame)
        self.Label5_14.place(relx=0.021, rely=0.276, height=26, width=151)
        self.Label5_14.configure(activebackground="#f9f9f9")
        self.Label5_14.configure(activeforeground="black")
        self.Label5_14.configure(background="#d1b9f9")
        self.Label5_14.configure(cursor="fleur")
        self.Label5_14.configure(disabledforeground="#a3a3a3")
        self.Label5_14.configure(foreground="#000000")
        self.Label5_14.configure(highlightbackground="#d9d9d9")
        self.Label5_14.configure(highlightcolor="black")
        self.Label5_14.configure(text='''No of components''')
        
        self.Label4_12 = tk.Label(self.feature_frame)
        self.Label4_12.place(relx=-0.041, rely=0.552, height=26, width=522)
        self.Label4_12.configure(activebackground="#f9f9f9")
        self.Label4_12.configure(activeforeground="black")
        self.Label4_12.configure(background="#c6bff2")
        self.Label4_12.configure(disabledforeground="#a3a3a3")
        self.Label4_12.configure(font="-family {Segoe UI} -size 9 -weight bold")
        self.Label4_12.configure(foreground="#000000")
        self.Label4_12.configure(highlightbackground="#d9d9d9")
        self.Label4_12.configure(highlightcolor="#646464646464")
        self.Label4_12.configure(text='''Feature Selection (KBest)''')
        
        self.Label5_18 = tk.Label(self.feature_frame)
        self.Label5_18.place(relx=0.021, rely=0.759, height=26, width=151)
        self.Label5_18.configure(activebackground="#f9f9f9")
        self.Label5_18.configure(activeforeground="black")
        self.Label5_18.configure(background="#d1b9f9")
        self.Label5_18.configure(disabledforeground="#a3a3a3")
        self.Label5_18.configure(foreground="#000000")
        self.Label5_18.configure(highlightbackground="#d9d9d9")
        self.Label5_18.configure(highlightcolor="black")
        self.Label5_18.configure(text='''No. of features''')

############################################################################### Buttons and other
        A=1        
#%%                                                                             Dataset Frame
        """Combo box"""
        self.format_box = ttk.Combobox(self.dataset_frame)
        self.format_box.place(relx=0.79, rely=0.486, relheight=0.141
                , relwidth=0.182)
        self.format_box.configure(textvariable=UI_v_203_support.combobox_train)
        self.format_box.configure(takefocus="")
        
        self.format_box['values'] = (' Matlab Matrix File',  
                          ' EDF File')
        self.format_box.current(0)  
        
        self.format_box_7 = ttk.Combobox(self.dataset_frame)
        self.format_box_7.place(relx=0.79, rely=0.757, relheight=0.141
                , relwidth=0.182)
        self.format_box_7.configure(textvariable=UI_v_203_support.combobox_test)
        self.format_box_7.configure(takefocus="")
        self.format_box_7['values'] = (' Matlab Matrix File',  
                          ' EDF File')
        self.format_box_7.current(0) 
         
        
        """Radio buttons"""
        self.tas = tk.Radiobutton(self.dataset_frame)
        self.tas.place(relx=0.185, rely=0.27, relheight=0.168, relwidth=0.06)
        self.tas.configure(activebackground="#ececec")
        self.tas.configure(activeforeground="#000000")
        self.tas.configure(background="#d9d9d9")
        self.tas.configure(disabledforeground="#a3a3a3")
        self.tas.configure(foreground="#000000")
        self.tas.configure(highlightbackground="#d9d9d9")
        self.tas.configure(highlightcolor="black")
        self.tas.configure(justify='left')
        self.tas.configure(text='''Auto''')
        self.tas.configure(value=0)
        self.tas.configure(variable=UI_v_203_support.auto_task_selection)
        self.tas.configure(command=self.auto_class)

        self.Radiobutton2 = tk.Radiobutton(self.dataset_frame)
        self.Radiobutton2.place(relx=0.263, rely=0.27, relheight=0.168
                , relwidth=0.076)
        self.Radiobutton2.configure(activebackground="#ececec")
        self.Radiobutton2.configure(activeforeground="#000000")
        self.Radiobutton2.configure(background="#d9d9d9")
        self.Radiobutton2.configure(disabledforeground="#a3a3a3")
        self.Radiobutton2.configure(foreground="#000000")
        self.Radiobutton2.configure(highlightbackground="#d9d9d9")
        self.Radiobutton2.configure(highlightcolor="black")
        self.Radiobutton2.configure(justify='left')
        self.Radiobutton2.configure(text='''Manual''')
        self.Radiobutton2.configure(value=1)
        self.Radiobutton2.configure(variable=UI_v_203_support.auto_task_selection)
        self.Radiobutton2.configure(command=self.man_class)
        


        """Buttons """
        self.select_folder = tk.Button(self.dataset_frame)
        self.select_folder.place(relx=0.550, rely=0.486, height=33, width=106)
        self.select_folder.configure(activebackground="#ececec")
        self.select_folder.configure(activeforeground="#000000")
        self.select_folder.configure(background="#d9d9d9")
        self.select_folder.configure(disabledforeground="#a3a3a3")
        self.select_folder.configure(foreground="#000000")
        self.select_folder.configure(highlightbackground="#d9d9d9")
        self.select_folder.configure(highlightcolor="black")
        self.select_folder.configure(pady="0")
        self.select_folder.configure(text='''Select File''')
        self.select_folder.configure(command=self.folder_sel)
        
        
        self.path_traiin = tk.Text(self.dataset_frame)
        self.path_traiin.place(relx=0.150, rely=0.486, relheight=0.13
                , relwidth=0.387)
        self.path_traiin.configure(background="white")
        self.path_traiin.configure(font="TkTextFont")
        self.path_traiin.configure(foreground="black")
        self.path_traiin.configure(highlightbackground="#d9d9d9")
        self.path_traiin.configure(highlightcolor="black")
        self.path_traiin.configure(insertbackground="black")
        self.path_traiin.configure(selectbackground="#c4c4c4")
        self.path_traiin.configure(selectforeground="black")
        self.path_traiin.configure(wrap="word")
        
        self.select_folder_5 = tk.Button(self.dataset_frame)
        self.select_folder_5.place(relx=0.550, rely=0.757, height=33, width=106)
        self.select_folder_5.configure(activebackground="#ececec")
        self.select_folder_5.configure(activeforeground="#000000")
        self.select_folder_5.configure(background="#d9d9d9")
        self.select_folder_5.configure(disabledforeground="#a3a3a3")
        self.select_folder_5.configure(foreground="#000000")
        self.select_folder_5.configure(highlightbackground="#d9d9d9")
        self.select_folder_5.configure(highlightcolor="black")
        self.select_folder_5.configure(pady="0")
        self.select_folder_5.configure(text='''Select File''')
        self.select_folder_5.configure(command=self.folder_sel_2)
        
        self.path_test = tk.Text(self.dataset_frame)
        self.path_test.place(relx=0.150, rely=0.757, relheight=0.13
                , relwidth=0.387)
        self.path_test.configure(background="white")
        self.path_test.configure(font="TkTextFont")
        self.path_test.configure(foreground="black")
        self.path_test.configure(highlightbackground="#d9d9d9")
        self.path_test.configure(highlightcolor="black")
        self.path_test.configure(insertbackground="black")
        self.path_test.configure(selectbackground="#c4c4c4")
        self.path_test.configure(selectforeground="black")
        self.path_test.configure(wrap="word")
#%%                                                                              Bandpass filter frame
        X=1
        """Radio button"""
        self.butter_radio = tk.Radiobutton(self.bandpass_frame)
        self.butter_radio.place(relx=0.291, rely=0.303, relheight=0.188
                , relwidth=0.208)
        self.butter_radio.configure(activebackground="#ececec")
        self.butter_radio.configure(activeforeground="#000000")
        self.butter_radio.configure(background="#d9d9d9")
        self.butter_radio.configure(disabledforeground="#a3a3a3")
        self.butter_radio.configure(foreground="#000000")
        self.butter_radio.configure(highlightbackground="#d9d9d9")
        self.butter_radio.configure(highlightcolor="black")
        self.butter_radio.configure(justify='left')
        self.butter_radio.configure(text='''Butterworth''')
        self.butter_radio.configure(value="0")
        self.butter_radio.configure(variable=UI_v_203_support.bandpass_cheby)

        self.butter_radio_1 = tk.Radiobutton(self.bandpass_frame)
        self.butter_radio_1.place(relx=0.524, rely=0.303, relheight=0.188
                , relwidth=0.208)
        self.butter_radio_1.configure(activebackground="#ececec")
        self.butter_radio_1.configure(activeforeground="#000000")
        self.butter_radio_1.configure(background="#d9d9d9")
        self.butter_radio_1.configure(disabledforeground="#a3a3a3")
        self.butter_radio_1.configure(foreground="#000000")
        self.butter_radio_1.configure(highlightbackground="#d9d9d9")
        self.butter_radio_1.configure(highlightcolor="black")
        self.butter_radio_1.configure(justify='left')
        self.butter_radio_1.configure(text='''Chebyshev II''')
        self.butter_radio_1.configure(value="1")
        self.butter_radio_1.configure(variable=UI_v_203_support.bandpass_cheby)

        """Entries"""  
        self.lowcut = tk.Entry(self.bandpass_frame)
        self.lowcut.place(relx=0.291, rely=0.545,height=24, relwidth=0.163)
        self.lowcut.configure(background="white")
        self.lowcut.configure(disabledforeground="#a3a3a3")
        self.lowcut.configure(font="TkFixedFont")
        self.lowcut.configure(foreground="#000000")
        self.lowcut.configure(highlightbackground="#d9d9d9")
        self.lowcut.configure(highlightcolor="black")
        self.lowcut.configure(insertbackground="black")
        self.lowcut.configure(selectbackground="#c4c4c4")
        self.lowcut.configure(selectforeground="black")

        self.highcut = tk.Entry(self.bandpass_frame)
        self.highcut.place(relx=0.816, rely=0.545,height=24, relwidth=0.163)
        self.highcut.configure(background="white")
        self.highcut.configure(disabledforeground="#a3a3a3")
        self.highcut.configure(font="TkFixedFont")
        self.highcut.configure(foreground="#000000")
        self.highcut.configure(highlightbackground="#d9d9d9")
        self.highcut.configure(highlightcolor="black")
        self.highcut.configure(insertbackground="black")
        self.highcut.configure(selectbackground="#c4c4c4")
        self.highcut.configure(selectforeground="black")


        self.ord = tk.Entry(self.bandpass_frame)
        self.ord.place(relx=0.291, rely=0.788,height=24, relwidth=0.163)
        self.ord.configure(background="white")
        self.ord.configure(disabledforeground="#a3a3a3")
        self.ord.configure(font="TkFixedFont")
        self.ord.configure(foreground="#000000")
        self.ord.configure(highlightbackground="#d9d9d9")
        self.ord.configure(highlightcolor="black")
        self.ord.configure(insertbackground="black")
        self.ord.configure(selectbackground="#c4c4c4")
        self.ord.configure(selectforeground="black")
        
        self.fs = tk.Entry(self.bandpass_frame)
        self.fs.place(relx=0.816, rely=0.788,height=24, relwidth=0.163)
        self.fs.configure(background="white")
        self.fs.configure(disabledforeground="#a3a3a3")
        self.fs.configure(font="TkFixedFont")
        self.fs.configure(foreground="#000000")
        self.fs.configure(highlightbackground="#d9d9d9")
        self.fs.configure(highlightcolor="black")
        self.fs.configure(insertbackground="black")
        self.fs.configure(selectbackground="#c4c4c4")
        self.fs.configure(selectforeground="black")

#%%                                                                             feature frame
        Y=2
        self.n_cmp = tk.Entry(self.feature_frame)
        self.n_cmp.place(relx=0.371, rely=0.276,height=24, relwidth=0.173)
        self.n_cmp.configure(background="white")
        self.n_cmp.configure(disabledforeground="#a3a3a3")
        self.n_cmp.configure(font="TkFixedFont")
        self.n_cmp.configure(foreground="#000000")
        self.n_cmp.configure(highlightbackground="#d9d9d9")
        self.n_cmp.configure(highlightcolor="black")
        self.n_cmp.configure(insertbackground="black")
        self.n_cmp.configure(selectbackground="#c4c4c4")
        self.n_cmp.configure(selectforeground="black")
        
        self.n_ft = tk.Entry(self.feature_frame)
        self.n_ft.place(relx=0.371, rely=0.759,height=24, relwidth=0.173)
        self.n_ft.configure(background="white")
        self.n_ft.configure(disabledforeground="#a3a3a3")
        self.n_ft.configure(font="TkFixedFont")
        self.n_ft.configure(foreground="#000000")
        self.n_ft.configure(highlightbackground="#d9d9d9")
        self.n_ft.configure(highlightcolor="black")
        self.n_ft.configure(insertbackground="black")
        self.n_ft.configure(selectbackground="#c4c4c4")
        self.n_ft.configure(selectforeground="black")
        
#%%                                                                             Classifiaction metric frame
        Z=1
        self.keppa_scr = tk.Radiobutton(self.metric_frame)
        self.keppa_scr.place(relx=0.136, rely=0.533, relheight=0.413
                , relwidth=0.19)
        self.keppa_scr.configure(activebackground="#ececec")
        self.keppa_scr.configure(activeforeground="#000000")
        self.keppa_scr.configure(background="#d9d9d9")
        self.keppa_scr.configure(disabledforeground="#a3a3a3")
        self.keppa_scr.configure(foreground="#000000")
        self.keppa_scr.configure(highlightbackground="#d9d9d9")
        self.keppa_scr.configure(highlightcolor="black")
        self.keppa_scr.configure(justify='left')
        self.keppa_scr.configure(text='''Accuracy''')
        self.keppa_scr.configure(value="0")
        self.keppa_scr.configure(variable=UI_v_203_support.is_keppa)

        self.keppa_scr_1 = tk.Radiobutton(self.metric_frame)
        self.keppa_scr_1.place(relx=0.485, rely=0.533, relheight=0.413
                , relwidth=0.249)
        self.keppa_scr_1.configure(activebackground="#ececec")
        self.keppa_scr_1.configure(activeforeground="#000000")
        self.keppa_scr_1.configure(background="#d9d9d9")
        self.keppa_scr_1.configure(cursor="fleur")
        self.keppa_scr_1.configure(disabledforeground="#a3a3a3")
        self.keppa_scr_1.configure(foreground="#000000")
        self.keppa_scr_1.configure(highlightbackground="#d9d9d9")
        self.keppa_scr_1.configure(highlightcolor="black")
        self.keppa_scr_1.configure(justify='left')
        self.keppa_scr_1.configure(text='''Kappa Score''')
        self.keppa_scr_1.configure(value="1")
        self.keppa_scr_1.configure(variable=UI_v_203_support.is_keppa)


#%%                                                                             Channel selection Frame   
        B=2
        """Buttons"""
        self.chnl_sel_all = tk.Radiobutton(self.channel_select)
        self.chnl_sel_all.place(relx=0.206, rely=0.526, height=33, width=91)
        self.chnl_sel_all.configure(activebackground="#ececec")
        self.chnl_sel_all.configure(activeforeground="#000000")
        self.chnl_sel_all.configure(background="#d9d9d9")
        self.chnl_sel_all.configure(disabledforeground="#a3a3a3")
        self.chnl_sel_all.configure(foreground="#000000")
        self.chnl_sel_all.configure(highlightbackground="#d9d9d9")
        self.chnl_sel_all.configure(highlightcolor="black")
        self.chnl_sel_all.configure(justify='left')
        self.chnl_sel_all.configure(text='''All channels''')
        self.chnl_sel_all.configure(value="0")
        self.chnl_sel_all.configure(variable=UI_v_203_support.all_sel)

        self.chnl_sel_man = tk.Radiobutton(self.channel_select)
        self.chnl_sel_man.place(relx=0.577, rely=0.526, height=33, width=126)
        self.chnl_sel_man.configure(activebackground="#ececec")
        self.chnl_sel_man.configure(activeforeground="#000000")
        self.chnl_sel_man.configure(background="#d9d9d9")
        self.chnl_sel_man.configure(disabledforeground="#a3a3a3")
        self.chnl_sel_man.configure(foreground="#000000")
        self.chnl_sel_man.configure(highlightbackground="#d9d9d9")
        self.chnl_sel_man.configure(highlightcolor="black")
        self.chnl_sel_man.configure(justify='left')
        self.chnl_sel_man.configure(text='''Manual Selection''')
        self.chnl_sel_man.configure(value="1")
        self.chnl_sel_man.configure(variable=UI_v_203_support.all_sel)
        self.chnl_sel_man.configure(command=self.popup_open)
#%%                                                                             report frame
        C=3
        """"""
        
        """Check Buttons"""   
        self.cnn_cb = tk.Checkbutton(self.report_frame)
        self.cnn_cb.place(relx=0.029, rely=0.306, relheight=0.100
                , relwidth=0.06)
        self.cnn_cb.configure(activebackground="#ececec")
        self.cnn_cb.configure(activeforeground="#000000")
        self.cnn_cb.configure(background="#d9d9d9")
        self.cnn_cb.configure(disabledforeground="#a3a3a3")
        self.cnn_cb.configure(foreground="#000000")
        self.cnn_cb.configure(highlightbackground="#d9d9d9")
        self.cnn_cb.configure(highlightcolor="black")
        self.cnn_cb.configure(justify='left')
        self.cnn_cb.configure(text='''CNN''')
        self.cnn_cb.configure(variable=UI_v_203_support.cnn)

        self.ann_cb = tk.Checkbutton(self.report_frame)
        self.ann_cb.place(relx=0.029, rely=0.44, relheight=0.100
                , relwidth=0.06)
        self.ann_cb.configure(activebackground="#ececec")
        self.ann_cb.configure(activeforeground="#000000")
        self.ann_cb.configure(background="#d9d9d9")
        self.ann_cb.configure(disabledforeground="#a3a3a3")
        self.ann_cb.configure(foreground="#000000")
        self.ann_cb.configure(highlightbackground="#d9d9d9")
        self.ann_cb.configure(highlightcolor="black")
        self.ann_cb.configure(justify='left')
        self.ann_cb.configure(text='''ANN''')
        self.ann_cb.configure(variable=UI_v_203_support.ann)

        self.dbn_cb = tk.Checkbutton(self.report_frame)
        self.dbn_cb.place(relx=0.029, rely=0.573, relheight=0.100
                , relwidth=0.06)
        self.dbn_cb.configure(activebackground="#ececec")
        self.dbn_cb.configure(activeforeground="#000000")
        self.dbn_cb.configure(background="#d9d9d9")
        self.dbn_cb.configure(disabledforeground="#a3a3a3")
        self.dbn_cb.configure(foreground="#000000")
        self.dbn_cb.configure(highlightbackground="#d9d9d9")
        self.dbn_cb.configure(highlightcolor="black")
        self.dbn_cb.configure(justify='left')
        self.dbn_cb.configure(text='''DBN''')
        self.dbn_cb.configure(variable=UI_v_203_support.dbn)

        self.lda_cb = tk.Checkbutton(self.report_frame)
        self.lda_cb.place(relx=0.029, rely=0.717, relheight=0.100
                , relwidth=0.06)
        self.lda_cb.configure(activebackground="#ececec")
        self.lda_cb.configure(activeforeground="#000000")
        self.lda_cb.configure(background="#d9d9d9")
        self.lda_cb.configure(disabledforeground="#a3a3a3")
        self.lda_cb.configure(foreground="#000000")
        self.lda_cb.configure(highlightbackground="#d9d9d9")
        self.lda_cb.configure(highlightcolor="black")
        self.lda_cb.configure(justify='left')
        self.lda_cb.configure(text='''LDA''')
        self.lda_cb.configure(variable=UI_v_203_support.lda)

        self.rf_cb = tk.Checkbutton(self.report_frame)
        self.rf_cb.place(relx=0.025, rely=0.869, relheight=0.100
                , relwidth=0.126)
        self.rf_cb.configure(activebackground="#ececec")
        self.rf_cb.configure(activeforeground="#000000")
        self.rf_cb.configure(background="#d9d9d9")
        self.rf_cb.configure(disabledforeground="#a3a3a3")
        self.rf_cb.configure(foreground="#000000")
        self.rf_cb.configure(highlightbackground="#d9d9d9")
        self.rf_cb.configure(highlightcolor="black")
        self.rf_cb.configure(justify='left')
        self.rf_cb.configure(text='''Random Forest''')
        self.rf_cb.configure(variable=UI_v_203_support.rf)

        self.knn_cb = tk.Checkbutton(self.report_frame)
        self.knn_cb.place(relx=0.465, rely=0.717, relheight=0.100
                , relwidth=0.19)
        self.knn_cb.configure(activebackground="#ececec")
        self.knn_cb.configure(activeforeground="#000000")
        self.knn_cb.configure(background="#d9d9d9")
        self.knn_cb.configure(disabledforeground="#a3a3a3")
        self.knn_cb.configure(foreground="#000000")
        self.knn_cb.configure(highlightbackground="#d9d9d9")
        self.knn_cb.configure(highlightcolor="black")
        self.knn_cb.configure(justify='left')
        self.knn_cb.configure(text='''KNN''')
        self.knn_cb.configure(variable=UI_v_203_support.knn)

        self.svm_rbf_cb = tk.Checkbutton(self.report_frame)
        self.svm_rbf_cb.place(relx=0.500, rely=0.306, relheight=0.100
                , relwidth=0.19)
        self.svm_rbf_cb.configure(activebackground="#ececec")
        self.svm_rbf_cb.configure(activeforeground="#000000")
        self.svm_rbf_cb.configure(background="#d9d9d9")
        self.svm_rbf_cb.configure(disabledforeground="#a3a3a3")
        self.svm_rbf_cb.configure(foreground="#000000")
        self.svm_rbf_cb.configure(highlightbackground="#d9d9d9")
        self.svm_rbf_cb.configure(highlightcolor="black")
        self.svm_rbf_cb.configure(justify='left')
        self.svm_rbf_cb.configure(text='''SVM (Kernel=RBF)''')
        self.svm_rbf_cb.configure(variable=UI_v_203_support.svm_rbf)

        self.svm_lin_cb = tk.Checkbutton(self.report_frame)
        self.svm_lin_cb.place(relx=0.506, rely=0.573, relheight=0.100
                , relwidth=0.19)
        self.svm_lin_cb.configure(activebackground="#ececec")
        self.svm_lin_cb.configure(activeforeground="#000000")
        self.svm_lin_cb.configure(background="#d9d9d9")
        self.svm_lin_cb.configure(disabledforeground="#a3a3a3")
        self.svm_lin_cb.configure(foreground="#000000")
        self.svm_lin_cb.configure(highlightbackground="#d9d9d9")
        self.svm_lin_cb.configure(highlightcolor="black")
        self.svm_lin_cb.configure(justify='left')
        self.svm_lin_cb.configure(text='''SVM (Kernel=Linear)''')
        self.svm_lin_cb.configure(variable=UI_v_203_support.svm_lin)

        self.svm_poli_cb = tk.Checkbutton(self.report_frame)
        self.svm_poli_cb.place(relx=0.518, rely=0.44, relheight=0.100
                , relwidth=0.19)
        self.svm_poli_cb.configure(activebackground="#ececec")
        self.svm_poli_cb.configure(activeforeground="#000000")
        self.svm_poli_cb.configure(background="#d9d9d9")
        self.svm_poli_cb.configure(disabledforeground="#a3a3a3")
        self.svm_poli_cb.configure(foreground="#000000")
        self.svm_poli_cb.configure(highlightbackground="#d9d9d9")
        self.svm_poli_cb.configure(highlightcolor="black")
        self.svm_poli_cb.configure(justify='left')
        self.svm_poli_cb.configure(text='''SVM (Kernel=Polinomial)''')
        self.svm_poli_cb.configure(variable=UI_v_203_support.svm_poli)

        """Results"""
        self.cnn_res = tk.Text(self.report_frame)
        self.cnn_res.place(relx=0.200, rely=0.310, relheight=0.100
                , relwidth=0.100)
        self.cnn_res.configure(background="white")
        self.cnn_res.configure(font="TkTextFont")
        self.cnn_res.configure(foreground="black")
        self.cnn_res.configure(highlightbackground="#d9d9d9")
        self.cnn_res.configure(highlightcolor="black")
        self.cnn_res.configure(insertbackground="black")
        self.cnn_res.configure(selectbackground="#c4c4c4")
        self.cnn_res.configure(selectforeground="black")
        self.cnn_res.configure(wrap="word")
        
        self.ann_res = tk.Text(self.report_frame)
        self.ann_res.place(relx=0.200, rely=0.46, relheight=0.100
                , relwidth=0.100)
        self.ann_res.configure(background="white")
        self.ann_res.configure(font="TkTextFont")
        self.ann_res.configure(foreground="black")
        self.ann_res.configure(highlightbackground="#d9d9d9")
        self.ann_res.configure(highlightcolor="black")
        self.ann_res.configure(insertbackground="black")
        self.ann_res.configure(selectbackground="#c4c4c4")
        self.ann_res.configure(selectforeground="black")
        self.ann_res.configure(wrap="word")

        self.dbn_res = tk.Text(self.report_frame)
        self.dbn_res.place(relx=0.200, rely=0.597, relheight=0.100
                , relwidth=0.100)
        self.dbn_res.configure(background="white")
        self.dbn_res.configure(font="TkTextFont")
        self.dbn_res.configure(foreground="black")
        self.dbn_res.configure(highlightbackground="#d9d9d9")
        self.dbn_res.configure(highlightcolor="black")
        self.dbn_res.configure(insertbackground="black")
        self.dbn_res.configure(selectbackground="#c4c4c4")
        self.dbn_res.configure(selectforeground="black")
        self.dbn_res.configure(wrap="word")

        self.lda_res = tk.Text(self.report_frame)
        self.lda_res.place(relx=0.200, rely=0.733, relheight=0.100
                , relwidth=0.100)
        self.lda_res.configure(background="white")
        self.lda_res.configure(font="TkTextFont")
        self.lda_res.configure(foreground="black")
        self.lda_res.configure(highlightbackground="#d9d9d9")
        self.lda_res.configure(highlightcolor="black")
        self.lda_res.configure(insertbackground="black")
        self.lda_res.configure(selectbackground="#c4c4c4")
        self.lda_res.configure(selectforeground="black")
        self.lda_res.configure(wrap="word")

        self.rf_res = tk.Text(self.report_frame)
        self.rf_res.place(relx=0.200, rely=0.869, relheight=0.100
                , relwidth=0.100)
        self.rf_res.configure(background="white")
        self.rf_res.configure(font="TkTextFont")
        self.rf_res.configure(foreground="black")
        self.rf_res.configure(highlightbackground="#d9d9d9")
        self.rf_res.configure(highlightcolor="black")
        self.rf_res.configure(insertbackground="black")
        self.rf_res.configure(selectbackground="#c4c4c4")
        self.rf_res.configure(selectforeground="black")
        self.rf_res.configure(wrap="word")

        self.svm_rbf_res = tk.Text(self.report_frame)
        self.svm_rbf_res.place(relx=0.710, rely=0.310, relheight=0.100
                , relwidth=0.100)
        self.svm_rbf_res.configure(background="white")
        self.svm_rbf_res.configure(font="TkTextFont")
        self.svm_rbf_res.configure(foreground="black")
        self.svm_rbf_res.configure(highlightbackground="#d9d9d9")
        self.svm_rbf_res.configure(highlightcolor="black")
        self.svm_rbf_res.configure(insertbackground="black")
        self.svm_rbf_res.configure(selectbackground="#c4c4c4")
        self.svm_rbf_res.configure(selectforeground="black")
        self.svm_rbf_res.configure(wrap="word")

        self.svm_poli_res = tk.Text(self.report_frame)
        self.svm_poli_res.place(relx=0.710, rely=0.46, relheight=0.100
                , relwidth=0.100)
        self.svm_poli_res.configure(background="white")
        self.svm_poli_res.configure(font="TkTextFont")
        self.svm_poli_res.configure(foreground="black")
        self.svm_poli_res.configure(highlightbackground="#d9d9d9")
        self.svm_poli_res.configure(highlightcolor="black")
        self.svm_poli_res.configure(insertbackground="black")
        self.svm_poli_res.configure(selectbackground="#c4c4c4")
        self.svm_poli_res.configure(selectforeground="black")
        self.svm_poli_res.configure(wrap="word")

        self.svm_lin_res = tk.Text(self.report_frame)
        self.svm_lin_res.place(relx=0.710, rely=0.597, relheight=0.100
                , relwidth=0.100)
        self.svm_lin_res.configure(background="white")
        self.svm_lin_res.configure(font="TkTextFont")
        self.svm_lin_res.configure(foreground="black")
        self.svm_lin_res.configure(highlightbackground="#d9d9d9")
        self.svm_lin_res.configure(highlightcolor="black")
        self.svm_lin_res.configure(insertbackground="black")
        self.svm_lin_res.configure(selectbackground="#c4c4c4")
        self.svm_lin_res.configure(selectforeground="black")
        self.svm_lin_res.configure(wrap="word")

        self.knn_res = tk.Text(self.report_frame)
        self.knn_res.place(relx=0.710, rely=0.733, relheight=0.100
                , relwidth=0.100)
        self.knn_res.configure(background="white")
        self.knn_res.configure(font="TkTextFont")
        self.knn_res.configure(foreground="black")
        self.knn_res.configure(highlightbackground="#d9d9d9")
        self.knn_res.configure(highlightcolor="black")
        self.knn_res.configure(insertbackground="black")
        self.knn_res.configure(selectbackground="#c4c4c4")
        self.knn_res.configure(selectforeground="black")
        self.knn_res.configure(wrap="word")

if __name__ == '__main__':

    root = tk.Tk()
    # show no frame
    root.overrideredirect(True)
    width = root.winfo_screenwidth()
    height = root.winfo_screenheight()
    root.geometry('%dx%d+%d+%d' % (width*0.4, height*0.4, width*0.25, height*0.25))
    
    
    image_file = "images/logo.png"
    #assert os.path.exists(image_file)
    # use Tkinter's PhotoImage for .gif files
    image = tk.PhotoImage(file=image_file)
    canvas = tk.Canvas(root, height=height*0.8, width=width*0.8, bg="white")
    canvas.create_image(width*0.4/2, height*0.4/2, image=image)
    canvas.pack()
    
    # show the splash screen for 1500 milliseconds then destroy
    root.after(2000, root.destroy)
    root.mainloop()
    vp_start_gui()