def right_frame(parent):
        rf_width = 300
        rf_height = 360
        # right side frame
        frame_right = LabelFrame(
            parent.building_pos_window,
            text="Building Position",
            width=rf_width - 10,
            height=rf_height - 10,
        )

        frame_right.grid_rowconfigure(0, weight=1)
        frame_right.grid_columnconfigure(0, weight=1)
        frame_right.grid_propagate(False)

        canvas_right = Canvas(frame_right)
        canvas_right.grid(row=0, column=0, sticky=N + W)

        # Link a scrollbar to the canvas
        def on_mousewheel(event):
            canvas_right.yview_scroll(int(-1 * (event.delta / 120)), "units")

        def bound_to_mousewheel(event):
            canvas_right.bind_all("<MouseWheel>", on_mousewheel)

        def unbound_to_mousewheel(event):
            canvas_right.unbind_all("<MouseWheel>")

        y_scrollbar = Scrollbar(frame_right,
                                orient="vertical",
                                command=canvas_right.yview)
        y_scrollbar.grid(row=0, column=1, sticky='ns')
        canvas_right.configure(yscrollcommand=y_scrollbar.set)

        inner_frame_right = Frame(canvas_right)
        inner_frame_right.bind('<Enter>', bound_to_mousewheel)
        inner_frame_right.bind('<Leave>', unbound_to_mousewheel)

        canvas_right.create_window((0, 0),
                                   window=inner_frame_right,
                                   anchor='nw')

        idx = 0
        for e_name in BuildingNames:
            building_name_xy_config_frame(
                inner_frame_right, idx, e_name.value,
                parent.bot_building_pos.get(e_name.value, [-1, -1])
                if parent.bot_building_pos is not None else [-1, -1])
            idx = idx + 1

        inner_frame_right.update_idletasks()

        frame_right.config(width=rf_width - 10, height=360 - 10)
        canvas_right.config(width=rf_width - 10,
                            height=360 - 10,
                            scrollregion=canvas_right.bbox("all"))

        frame_right.grid(row=0, column=1, padx=5, pady=5, sticky=N + W)

        return inner_frame_right
Beispiel #2
0
 def display_load_menu(self):
     """
     Builds a load menu that displays the three save slots. Loads the save information if the save file exists and
     uses different maze methods/fields to obtain information about the save such as the maze size, player location,
     trivia category, trivia difficulty, and time spent in game and displays this info.
     """
     saves = Frame(self.root, height=650, width=650, bg='SystemButtonFace')
     saves.grid(row=0, column=0)
     save = []
     load_instruct = "Loading will take a few seconds, and can be inconsistent.\n" \
                     "Wait a moment before clicking a save file again or exit the load menu and try again."
     instruct = Label(saves, text=load_instruct, font='Times 12', pady=10)
     instruct.grid(row=0, column=0)
     for i in range(1, 4):
         savelabel = LabelFrame(saves,
                                height=175,
                                width=550,
                                text=f'Save {i}',
                                cursor='hand1',
                                font='Times 16')
         savelabel.grid(row=i, column=0, sticky=E)
         savelabel.grid_propagate(0)
         try:
             loadhandle = open(f'save_file_{i}.pkl', 'rb')
             maze = pickle.load(loadhandle)
             info = [
                 f'Rows: {maze.get_size()[0]}',
                 f'Columns: {maze.get_size()[1]}',
                 f'Difficulty: {maze.difficulty}',
                 f'Category: {maze.category}',
                 f'Position: {maze.player_location}',
                 f'Time: {maze.get_time()}'
             ]
             for j in range(len(info)):
                 label = Label(savelabel,
                               text=info[j],
                               font='Times 14',
                               anchor=W,
                               padx=5,
                               pady=10)
                 label.grid(row=j % 2, column=j // 2, sticky=W)
             loadhandle.close()
             save_file = "save_file_" + str(i)
             savelabel.bind(
                 '<Button-1>',
                 partial(self.load_game, save_file, load_menu=saves))
         except FileNotFoundError:
             continue
         save.append(savelabel)
     back_button = Button(
         saves,
         text="Back",
         font='Times 20',
         anchor=N,
         command=lambda: self.screen_switch(saves, self.startmenu))
     back_button.grid(row=4, column=0)
Beispiel #3
0
    def config_frame(self):
        frame_canvas = LabelFrame(self,
                                  text='Config',
                                  width=self.windows_size[0],
                                  height=self.windows_size[1] - 200
                                  )
        frame_canvas.grid_rowconfigure(0, weight=1)
        frame_canvas.grid_columnconfigure(0, weight=1)
        frame_canvas.grid_propagate(False)

        # Add a canvas in that frame
        canvas = Canvas(frame_canvas)
        canvas.grid(row=0, column=0, sticky=N+W)

        # Link a scrollbar to the canvas

        def on_mousewheel(event):
            canvas.yview_scroll(int(-1*(event.delta/120)), "units")

        def bound_to_mousewheel(event):
            canvas.bind_all("<MouseWheel>", on_mousewheel)

        def unbound_to_mousewheel(event):
            canvas.unbind_all("<MouseWheel>")

        y_scrollbar = Scrollbar(frame_canvas, orient="vertical", command=canvas.yview)
        y_scrollbar.grid(row=0, column=1, sticky='ns')
        canvas.configure(yscrollcommand=y_scrollbar.set)

        inner_frame = Frame(canvas)
        inner_frame.bind('<Enter>', bound_to_mousewheel)
        inner_frame.bind('<Leave>', unbound_to_mousewheel)

        canvas.create_window((0, 0), window=inner_frame, anchor='nw')

        for i in range(len(atf.bot_config_title_fns)):
            title_fns, sub_fns = atf.bot_config_title_fns[i]
            check = section_frame(
                self,
                inner_frame,
                title_fns,
                sub_fns
            )
            check.grid(row=i, column=0, sticky=N + W)

        inner_frame.update_idletasks()

        frame_canvas.config(width=self.windows_size[0] - 20, height=self.windows_size[1] - 350)
        canvas.config(width=self.windows_size[0] - 20, height=self.windows_size[1] - 350, scrollregion=canvas.bbox("all"))

        return frame_canvas
Beispiel #4
0
def main():

    root = tk.Tk()
    root.title('Financial Instruments - Main')
    root.geometry('720x444')
    root.configure(background='white')

    st = LabelFrame(root, text='Stock', width=200, height=100,bg='white', padx=5, pady=5)
    st.grid_propagate(False)
    st.grid(row=0,padx=5,pady=5)
    st_desp=Button(st,text='Statistics',font=('Candara',14), padx=5, pady=5,command=lambda: descrip_window(root))
    st_desp.grid(column=0)
    derv = LabelFrame(root, text='Derivative', width=200, height=100,bg='white', padx=5, pady=5)
    derv.grid(row=1,padx=5,pady=5)
    root.mainloop()
control_frame.columnconfigure(0, minsize=150)
control_frame.columnconfigure(1, minsize=150)
devices_frame.grid(column=0, row=4, columnspan=2, pady=10)
devices_canvas.pack(side="left", fill="both", expand=True)
devices_scrollbar.pack(side="right", fill="y")

search_button.grid(column=0, row=0, pady=10)
add_button.grid(column=1, row=0, pady=10)
ip_list.grid(column=0, row=1, columnspan=2, padx=5)
sep.grid(column=0, row=2, columnspan=2, pady=10, padx=10, sticky="ew")

devices_title.grid(column=0, row=3, columnspan=2)

info_lframe.grid(column=0, row=0, columnspan=4,
                 pady=5, padx=5, ipady=5, ipadx=5)
info_lframe.grid_propagate(0)
info_lframe.columnconfigure(1, minsize=100)
info_lframe.columnconfigure(3, minsize=50)
ip_info_label.grid(column=0, row=0)
ip_label.grid(column=1, row=0)
model_info_label.grid(column=2, row=0)
model_label.grid(column=3, row=0)
bulbImg.grid(column=0, row=1, rowspan=4, pady=15, padx=5)
on.grid(column=1, row=1)
off.grid(column=1, row=2)
rgb.grid(column=1, row=3)
delete.grid(column=1, row=4)
brightness.grid(column=0, row=5, columnspan=4)
temp.grid(column=0, row=6, columnspan=4)
color.grid(column=0, row=7, columnspan=4)
rgb_scale.grid(column=0, row=8, columnspan=4)
Beispiel #6
0
class MyFirstGUI():
    def __init__(self, master):
        self.master = master
        "----------------------------Constant---------------------------------"
        Classeur = r'C:\Users\jlaqueyr\Documents\MyNoteBook\ScriptPython\BorneDefaut\Feuille.xlsx'
        FeuilleDefaut = r'Liste des saisies'

        LBL_Z_INFO = 'Information générale'
        LARGEUR_FRAME = 485
        TITRE = 'Borne défaut'
        DIMENSION_FENETRE = '500x350+30+30'
        LBL_SFC = 'SFC'
        LBL_OPERATEUR = 'Nom'
        LBL_Z_LIGNE = 'Sur quel ligne est apparu le défaut ?'
        LBL_Z_DEF = 'Description du défaut'
        LBL_Z_DEF_INT = 'Intégration'
        LBL_Z_DEF_UFT = 'UFT et CADS'
        LBL_Z_DEF_ETI = 'Etiquettes'
        LBL_Z_DEF_CHOIX = "Choisir le défaut"

        NOM_LIGNE1 = 'Ligne Principale'
        NOM_LIGNE2 = 'Ligne Secondaire'
        PADX_INFO = 5
        PADX_LBL_INFO = 5
        PADY_INFO = 20
        PADX_BTN_LIGNE = 40
        PADY_BTN_LIGNE = 15
        PADX_ZN_DEF = 5
        PADY_ZN_DEF = 10
        MSG_SAUV_TITRE = "Ticket sauvegardé"
        MSG_SAUV_CONTENU = "Ticket défaut sauvegardé"
        VAL_DEF_CHOIX = 'Choix X'

        nomOperateur = StringVar(master)
        sfc = StringVar(master)
        master.title(TITRE)
        master.geometry(DIMENSION_FENETRE)
        "---------------------------Fonction----------------------------------"

        def callback(*args):
            print("tkvar changed")
            popupMenu2.configure(state='disable')
            popupMenu3.configure(state='disable')

        def callback2(*args):
            print("tkvar changed 1")
            popupMenu1.configure(state='disable')
            popupMenu3.configure(state='disable')

        def callback3(*args):
            print("tkvar changed 2")
            popupMenu1.configure(state='disable')
            popupMenu2.configure(state='disable')

        def testDefaut(listeDefaut, valDefaut):
            breakpoint()
            defaut = ""

            for defaut in listeDefaut:

                if defaut != valDefaut:
                    defFinal = defaut
                    break
                else:
                    pass

            return defFinal

        def RecupValeur():
            ListeInfo = []

            print(self.txtSfc.get(), self.txtNomOperateur.get(),
                  Ligne1Var.get(), Ligne2Var.get(), self.tkvar.get())

            listeLigne = [Ligne1Var.get(), Ligne2Var.get()]
            resultatLigne = testLigne(listeLigne, 'off')

            resultatSfc, ErrSfc = testSfc(sfc.get())
            breakpoint()
            self.listeDef = [
                self.tkvar.get(),
                self.tkvar1.get(),
                self.tkvar2.get()
            ]

            resultatDefaut = testDefaut(self.listeDef, VAL_DEF_CHOIX)

            ListeInfo = [
                resultatSfc,
                self.txtNomOperateur.get(), resultatLigne, resultatDefaut
            ]

            sauvDonnee(Classeur, ListeInfo, FeuilleDefaut)

            self.txtSfc.delete(0, 'end')
            self.txtNomOperateur.delete(0, 'end')
            self.btnLigne1.deselect()
            self.btnLigne2.deselect()

            popupMenu1.configure(state='active')
            popupMenu1.selection_clear()

            popupMenu2.configure(state='active')
            popupMenu2.selection_clear()

            popupMenu3.configure(state='active')
            popupMenu3.selection_clear()

            messagebox.showinfo(MSG_SAUV_TITRE, MSG_SAUV_CONTENU)

        "------------------Information sur le produit-------------------------"
        self.ZoneInfoGen = LabelFrame(master,
                                      text=LBL_Z_INFO,
                                      width=LARGEUR_FRAME,
                                      height=80)
        self.ZoneInfoGen.grid(row=0, column=1, sticky=N + S + W + E)
        self.ZoneInfoGen.grid_propagate(0)

        self.lblSfc = Label(self.ZoneInfoGen, text=LBL_SFC)
        self.txtSfc = Entry(self.ZoneInfoGen, textvariable=sfc)
        self.txtSfc.focus_set()
        self.lblNomOperateur = Label(self.ZoneInfoGen, text=LBL_OPERATEUR)
        self.txtNomOperateur = Entry(self.ZoneInfoGen,
                                     textvariable=nomOperateur)

        self.lblSfc.grid(row=0, column=1, padx=PADX_LBL_INFO, pady=PADY_INFO)
        self.txtSfc.grid(row=0,
                         column=2,
                         ipadx=25,
                         padx=PADX_INFO,
                         pady=PADY_INFO)
        self.lblNomOperateur.grid(row=0,
                                  column=3,
                                  padx=PADX_LBL_INFO,
                                  pady=PADY_INFO)
        self.txtNomOperateur.grid(row=0,
                                  column=4,
                                  ipadx=25,
                                  padx=PADX_INFO,
                                  pady=PADY_INFO)

        "----------Information sur la ligne qui a produit le défaut-----------"
        self.ZoneLigne = LabelFrame(master,
                                    text=LBL_Z_LIGNE,
                                    width=LARGEUR_FRAME,
                                    height=80)
        self.ZoneLigne.grid(row=1, column=1)
        self.ZoneLigne.grid_propagate(0)

        Ligne1Var = StringVar(value="off")
        self.btnLigne1 = Radiobutton(self.ZoneLigne,
                                     text=NOM_LIGNE1,
                                     variable=Ligne1Var,
                                     indicatoron=False,
                                     value="Ligne1")

        Ligne2Var = StringVar(value="off")
        self.btnLigne2 = Radiobutton(self.ZoneLigne,
                                     text=NOM_LIGNE2,
                                     variable=Ligne2Var,
                                     indicatoron=False,
                                     value="Ligne2")

        self.btnLigne1.grid(row=0,
                            column=1,
                            ipadx=30,
                            padx=PADX_BTN_LIGNE,
                            pady=PADY_BTN_LIGNE)
        self.btnLigne2.grid(row=0,
                            column=3,
                            ipadx=30,
                            padx=PADX_BTN_LIGNE,
                            pady=PADY_BTN_LIGNE)

        if self.btnLigne2.state():
            print(self.btnLigne2.state)

        if not self.btnLigne1.select():
            print(self.btnLigne1.get())
        "------------------Information sur le type de défaut-------------------"
        self.ZoneDefaut = LabelFrame(master,
                                     text=LBL_Z_DEF,
                                     width=LARGEUR_FRAME,
                                     height=130)
        self.ZoneDefaut.grid(row=2, column=1, sticky='NW')
        self.ZoneDefaut.grid_propagate(0)

        self.ZoneDefautInt = LabelFrame(self.ZoneDefaut,
                                        text=LBL_Z_DEF_INT,
                                        height=80,
                                        width=150)
        self.ZoneDefautInt.grid(row='0',
                                column='1',
                                padx=PADX_ZN_DEF,
                                pady=PADY_ZN_DEF)
        self.ZoneDefautInt.grid_propagate(0)

        self.tkvar = StringVar(master)
        choices = {'Choix 1', 'Choix 2', 'Choix 3', 'Choix 4', 'Choix 5'}
        self.tkvar.set(VAL_DEF_CHOIX)
        popupMenu1 = OptionMenu(self.ZoneDefautInt, self.tkvar, *choices)
        Label(self.ZoneDefautInt, text=LBL_Z_DEF_CHOIX).grid(row=1, column=1)
        popupMenu1.grid(row=2, column=1, ipadx=30)

        self.ZoneDefautUFT = LabelFrame(self.ZoneDefaut,
                                        text=LBL_Z_DEF_UFT,
                                        height=80,
                                        width=150)

        self.ZoneDefautUFT.grid(row='0',
                                column='2',
                                padx=PADX_ZN_DEF,
                                pady=PADY_ZN_DEF)
        self.ZoneDefautUFT.grid_propagate(0)
        self.tkvar1 = StringVar(master)
        choices = {'Choix 1', 'Choix 2', 'Choix 3', 'Choix 4', 'Choix 5'}
        self.tkvar1.set(VAL_DEF_CHOIX)
        popupMenu2 = OptionMenu(self.ZoneDefautUFT, self.tkvar1, *choices)
        Label(self.ZoneDefautUFT, text=LBL_Z_DEF_CHOIX).grid(row=1, column=1)
        popupMenu2.grid(row=2, column=1, ipadx=30)

        self.ZoneDefautEti = LabelFrame(self.ZoneDefaut,
                                        text=LBL_Z_DEF_ETI,
                                        height=80,
                                        width=150)
        self.ZoneDefautEti.grid(row='0',
                                column='3',
                                padx=PADX_ZN_DEF,
                                pady=PADY_ZN_DEF)
        self.ZoneDefautEti.grid_propagate(0)

        self.tkvar2 = StringVar(master)
        choices = {'Choix 1', 'Choix 2', 'Choix 3', 'Choix 4', 'Choix 5'}
        self.tkvar2.set(VAL_DEF_CHOIX)
        popupMenu3 = OptionMenu(self.ZoneDefautEti, self.tkvar2, *choices)
        Label(self.ZoneDefautEti, text=LBL_Z_DEF_CHOIX).grid(row=1, column=1)
        popupMenu3.grid(row=2, column=1, ipadx=30)

        self.btnValider = Button(master,
                                 text="Valider",
                                 relief="raised",
                                 command=RecupValeur)

        self.btnValider.grid(row=3, column=1)

        self.tkvar.trace("w", callback)
        self.tkvar1.trace('w', callback2)
        self.tkvar2.trace('w', callback3)
Beispiel #7
0
lbl_VSWR.place(x=45.5, y=31)
lbl_Z0.place(x=36, y=59)
txt_Gain.place(x=178, y=7)
txt_VSWR.place(x=178, y=35)
txt_Z0.place(x=178, y=63)

opt_Optimizer.grid(row=0, column=0, sticky="E")
opt_Optimizer.place(x=8, y=2)

lbl_Display.place(x=64, y=3)
lbl_MaxFunEval.place(x=51, y=31)
lbl_MaxIter.place(x=59.5, y=59)
lbl_TolFun.place(x=63.2, y=87)
lbl_FminconAlgo.place(x=85, y=115)

opt_fminconDisplay.place(x=176, y=2)
txt_MaxFunEval.place(x=178, y=35)
txt_MaxIter.place(x=178, y=63)
txt_TolFun.place(x=178, y=91)
opt_fminconAlgorithm.place(x=176, y=115)

antennaGeometry.grid_propagate(0)
frequencyFrame.grid_propagate(0)
frameMoM.grid_propagate(0)
passiveBounds.grid_propagate(0)
designGoals.grid_propagate(0)
optimizerFrame.grid_propagate(0)
fminconSettings.grid_propagate(0)

root.mainloop()
class Window:

    index_item = None

    def __init__(self, master, database):

        self.master = master
        self.database = database
        self.master.title('Tkinter Word Search')
        self.master.geometry('750x600')

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

        self.frame_statement = LabelFrame(self.master,
                                          text='Entry',
                                          width=500,
                                          height=150)
        self.frame_statement_list = LabelFrame(self.master,
                                               text='Statements',
                                               width=500,
                                               height=270)
        self.frame_vocalbulary = LabelFrame(self.master,
                                            text='Vocalbulary',
                                            width=200,
                                            height=420)
        self.frame_vectors = LabelFrame(self.master,
                                        text='Occurrences',
                                        width=750,
                                        height=150)

        self.label_statement = Label(self.frame_statement,
                                     text="Enter Statement:")
        self.label_statement.grid(row=0, column=0, sticky=W, pady=5, padx=10)

        self.entry_statement = Entry(self.frame_statement, width=58)
        self.entry_statement.grid(row=1,
                                  column=0,
                                  sticky=W,
                                  pady=5,
                                  padx=10,
                                  columnspan=4)

        self.listbox_statements = Listbox(self.frame_statement_list,
                                          width=59,
                                          height=10)
        self.listbox_statements.grid(row=0,
                                     column=0,
                                     sticky=W,
                                     pady=5,
                                     padx=10,
                                     columnspan=4)

        #Bind Select
        self.listbox_statements.bind('<<ListboxSelect>>',
                                     self.select_statement)

        self.listbox_vocalbulary = Listbox(self.frame_vocalbulary,
                                           width=23,
                                           height=20)
        self.listbox_vocalbulary.grid(row=0,
                                      column=0,
                                      sticky=W,
                                      pady=10,
                                      padx=5)

        self.listbox_vectors = Listbox(self.frame_vectors, width=87, height=6)
        self.listbox_vectors.grid(row=0, column=0, sticky=W, pady=10, padx=5)

        self.button_create = Button(self.frame_statement,
                                    text='Add',
                                    width=10,
                                    command=self.add)
        self.button_create.grid(row=2, column=0, sticky=W, pady=5, padx=10)

        self.button_update = Button(self.frame_statement,
                                    text='Update',
                                    width=10,
                                    command=self.update)
        self.button_update.grid(row=2, column=3, sticky=W, pady=5, padx=10)

        #self.button_vocalbulary         =       Button(self.frame_statement_list, text='Get Vocalbulary', width=15, command=self.generate_vocalbulary)
        #self.button_vocalbulary.grid(row=1, column=3, sticky=W, pady=5, padx=10)

        self.button_clear = Button(self.frame_statement_list,
                                   text='Clear List',
                                   width=15,
                                   command=self.clear)
        self.button_clear.grid(row=1, column=3, sticky=W, pady=5, padx=10)

        self.button_delete = Button(self.frame_statement_list,
                                    text='Remove',
                                    width=10,
                                    command=self.remove)
        self.button_delete.grid(row=1, column=0, sticky=W, pady=5, padx=10)

        self.button_delete["state"] = "disabled"
        self.button_update["state"] = "disabled"

        self.frame_statement.grid(row=0, column=0, sticky=W, pady=10, padx=10)
        self.frame_statement.grid_propagate(False)

        self.frame_statement_list.grid(row=1,
                                       column=0,
                                       sticky=W,
                                       pady=0,
                                       padx=10)
        self.frame_statement_list.grid_propagate(False)

        self.frame_vocalbulary.grid(row=0,
                                    column=1,
                                    sticky=W,
                                    pady=0,
                                    padx=15,
                                    rowspan=2)
        self.frame_vocalbulary.grid_propagate(False)

        self.frame_vectors.grid(row=2,
                                column=0,
                                sticky=W,
                                pady=0,
                                padx=15,
                                columnspan=2)
        self.frame_vectors.grid_propagate(False)

        self.populate_listbox_statement()

    def populate_listbox_statement(self):

        self.listbox_statements.delete(0, END)

        count = 0

        for item in self.database.read():

            self.listbox_statements.insert(count, item)

            count += 1

        self.entry_statement.delete(0, END)

        self.index_item == None

        if self.listbox_statements.size() == 0:
            self.button_clear["state"] = "disabled"
        else:
            self.button_clear["state"] = "active"

        self.button_delete["state"] = "disabled"
        self.button_update["state"] = "disabled"

        self.generate_vocalbulary()

    def add(self):

        if not self.entry_statement.get().strip():
            return

        statement = self.entry_statement.get().strip()

        self.database.create({'statement': statement})

        self.populate_listbox_statement()

    def update(self):

        if self.index_item == None or not self.entry_statement.get().strip():
            return

        data = {
            'id': self.index_item,
            'statement': self.entry_statement.get().strip()
        }

        self.database.update(data)

        self.populate_listbox_statement()

    def remove(self):

        if self.index_item == None:
            return

        self.database.delete(self.index_item)

        self.populate_listbox_statement()

    def clear(self):

        self.database.clear()
        self.populate_listbox_statement()

    def generate_vocalbulary(self):

        vocalbulary = []
        vector = []

        for item in self.listbox_statements.get(0, END):

            for word in item[1].split():

                if word.lower() not in vocalbulary:
                    vocalbulary.append(word.lower())

        self.listbox_vocalbulary.delete(0, END)
        self.listbox_vectors.delete(0, END)

        index = 0

        for word in vocalbulary:

            self.listbox_vocalbulary.insert(index, f"{index+1}.) {word}")
            index += 1

        index = 0

        for statement in self.listbox_statements.get(0, END):

            self.listbox_vectors.insert(
                index, self.generate_vectors(vocalbulary, statement[1]))
            index += 1

    def generate_vectors(self, vocalbulary, statement):

        count = 0
        vector = []

        for v in vocalbulary:

            count = 0

            for s in statement.lower().split():
                if (v == s):
                    count += 1

            vector.append(count)

        return vector

    def select_statement(self, event):

        if not self.listbox_statements.curselection():
            return

        index = self.listbox_statements.curselection()[0]

        self.entry_statement.delete(0, END)
        self.entry_statement.insert(END, self.listbox_statements.get(index)[1])

        self.index_item = self.listbox_statements.get(index)[0]

        self.button_delete["state"] = "active"
        self.button_update["state"] = "active"
    def __init__(self, vs, outputPath):
        # store the video stream object and output path, then initialize
        # the most recently read frame, thread for reading frames, and
        # the thread stop event
        self.vs = vs
        self.outputPath = "output"
        self.frame = None
        self.thread = None
        self.stopEvent = None
        # initialize the root window and image panel
        self.root = Tk()
        self.root.iconbitmap(
            "Resources/card+id+id+card+identity+identity+card+icon+icon-1320196206727682853.ico"
        )
        self.root.title("Card Generator")
        self.face_cascade = cv2.CascadeClassifier(
            "Resources/haarcascade_frontalface_default.xml")
        self.root.resizable(False, False)
        self.panel = None

        # Frame Creation
        frame_form = LabelFrame(self.root,
                                text="Date Personale",
                                padx=5,
                                pady=5,
                                width=350,
                                height=420)
        frame_form.grid_propagate(False)
        frame_form.grid(row=0, column=0, padx=10, pady=10)
        frame_video = LabelFrame(self.root,
                                 text="Captura Camera Web",
                                 padx=5,
                                 pady=5,
                                 width=500,
                                 height=420)
        frame_video.pack_propagate(False)
        frame_video.grid(row=0, column=1, padx=10, pady=10)
        frame_send = LabelFrame(self.root,
                                text="Salvare & Generare",
                                padx=5,
                                pady=5,
                                width=350,
                                height=234)
        frame_send.grid_propagate(False)
        frame_send.grid(row=1, column=0, padx=10, pady=10)
        frame_image = LabelFrame(self.root,
                                 text="Editare Imagine",
                                 padx=5,
                                 pady=5,
                                 width=500,
                                 height=234)
        frame_image.grid_propagate(False)
        frame_image.grid(row=1, column=1, padx=10, pady=10)

        # --------------Frame Form--------------
        # Label Init
        nume_label = Label(frame_form, text="Nume: ").grid(row=0,
                                                           column=0,
                                                           sticky="w")
        nume_empty_label = Label(frame_form, text="").grid(row=1, column=0)
        prenume_label = Label(frame_form, text="Prenume: ").grid(row=2,
                                                                 column=0,
                                                                 sticky="w")
        prenume_empty_label = Label(frame_form, text="").grid(row=3, column=0)
        cnp_label = Label(frame_form, text="CNP: ").grid(row=4,
                                                         column=0,
                                                         sticky="w")
        cnp_empty_label = Label(frame_form, text="").grid(row=5, column=0)
        matr_label = Label(frame_form, text="Nr. Matricol: ").grid(row=6,
                                                                   column=0,
                                                                   sticky="w")
        matr_empty_label = Label(frame_form, text="").grid(row=7, column=0)
        email_label = Label(frame_form, text="Email: ").grid(row=8,
                                                             column=0,
                                                             sticky="w")
        email_empty_label = Label(frame_form, text="").grid(row=9, column=0)
        uni_label = Label(frame_form, text="Universitate: ").grid(row=10,
                                                                  column=0,
                                                                  sticky="w")
        uni_empty_label = Label(frame_form, text="").grid(row=11, column=0)
        fac_label = Label(frame_form, text="Facultate: ").grid(row=12,
                                                               column=0,
                                                               sticky="w")
        fac_empty_label = Label(frame_form, text="").grid(row=13, column=0)
        an_label = Label(frame_form, text="An: ").grid(row=14,
                                                       column=0,
                                                       sticky="w")
        an_empty_label = Label(frame_form, text="").grid(row=15, column=0)

        # Entry Init
        matr_reg = (self.root.register(self.validate_matr), '%P')
        cnp_reg = (self.root.register(self.validate_cnp), '%P')
        email_reg = (self.root.register(self.validate_email), '%P')
        self.nume_entry = Entry(frame_form, width=40, borderwidth=5)
        self.nume_entry.grid(row=0, column=1)
        self.prenume_entry = Entry(frame_form, width=40, borderwidth=5)
        self.prenume_entry.grid(row=2, column=1)
        self.cnp_entry = Entry(frame_form,
                               width=40,
                               borderwidth=5,
                               validate="all",
                               validatecommand=cnp_reg)
        self.cnp_entry.grid(row=4, column=1)
        self.cnp_empty_entry = Label(frame_form, text="", fg="red")
        self.cnp_empty_entry.grid(row=5, column=1)
        self.matr_entry = Entry(frame_form,
                                width=40,
                                borderwidth=5,
                                validate="all",
                                validatecommand=matr_reg)
        self.matr_entry.grid(row=6, column=1)
        self.matr_empty_entry = Label(frame_form, text="", fg="red")
        self.matr_empty_entry.grid(row=7, column=1)
        self.email_entry = Entry(frame_form,
                                 width=40,
                                 borderwidth=5,
                                 validate="all",
                                 validatecommand=email_reg)
        self.email_entry.grid(row=8, column=1)
        self.email_empty_entry = Label(frame_form, text="", fg="red")
        self.email_empty_entry.grid(row=9, column=1)

        # Dropdown Init
        self.var_uni = StringVar()
        self.var_fac = StringVar()
        self.var_an = StringVar()
        uni_drop = OptionMenu(frame_form,
                              self.var_uni,
                              "UPT",
                              "UVT",
                              "UBB",
                              command=lambda x: self.pick(frame_form))
        uni_drop.grid(row=10, column=1, sticky="ew")
        print(self.var_uni.get())
        self.fac_drop = OptionMenu(frame_form, self.var_fac,
                                   "").grid(row=12, column=1, sticky="ew")
        an_drop = OptionMenu(frame_form, self.var_an, "1", "2", "3",
                             "4").grid(row=14, column=1, sticky="w")

        # --------------Frame Save & Export--------------
        # Label Init
        imagine_label = Label(frame_send,
                              text="Imagine de fundal: ").grid(row=0,
                                                               column=0,
                                                               sticky="w")
        imagine_empty_label = Label(frame_send, text="").grid(row=1, column=0)
        save_db_label = Label(frame_send, text="Salvare DB: ").grid(row=2,
                                                                    column=0,
                                                                    sticky="w")
        save_empty_label = Label(frame_send, text="").grid(row=3, column=0)
        generate_label = Label(frame_send,
                               text="Generare card: ").grid(row=4,
                                                            column=0,
                                                            sticky="w")
        generate_empty_label = Label(frame_send, text="").grid(row=5, column=0)
        # Button Init
        search = Button(frame_send,
                        text="Cauta Imagine",
                        padx=5,
                        pady=5,
                        command=lambda: self.search_im(frame_send))
        search.grid(row=0, column=1)
        self.photo_save = ImageTk.PhotoImage(
            Image.open("Resources/save.png").resize((75, 50)))
        save_btn = Button(frame_send,
                          image=self.photo_save,
                          command=self.db_save)
        save_btn.grid(row=2, column=1)
        self.photo_generate = ImageTk.PhotoImage(
            Image.open(
                "Resources/card+id+id+card+identity+identity+card+icon+icon-1320196206727682853.png"
            ).resize((75, 50)))
        self.generate_btn = Button(frame_send,
                                   image=self.photo_generate,
                                   padx=5,
                                   pady=5,
                                   state=DISABLED,
                                   command=self.generate)
        self.generate_btn.grid(row=4, column=1)

        # Descriptions
        self.var_preview = IntVar()
        preview = Checkbutton(frame_send,
                              text="Previzualizare",
                              variable=self.var_preview)
        preview.grid(row=4, column=2)

        # --------------Frame Webcam--------------
        # Inits
        web_btn = Button(frame_video,
                         text="Activare camera web",
                         command=self.Open_cam).pack()
        self.black_placeholder = ImageTk.PhotoImage(
            Image.open("Resources/placeholder.png").resize((400, 300)))
        self.web_feed = Label(frame_video, image=self.black_placeholder)
        self.web_feed.pack()
        self.take_btn = Button(frame_video,
                               text="Faceti poza",
                               padx=40,
                               pady=40,
                               state=DISABLED,
                               command=self.takeSnapshot)
        self.take_btn.pack()

        # --------------Frame Image--------------
        # Inits
        self.black_placeholder_image = ImageTk.PhotoImage(
            Image.open("Resources/placeholder.png").resize((200, 200)))
        self.image_feed = Label(frame_image,
                                image=self.black_placeholder_image)
        self.image_feed.grid(row=0, column=0, rowspan=4)
        self.filter1 = Button(frame_image,
                              text="Blur",
                              padx=5,
                              pady=5,
                              state=DISABLED,
                              command=self.fil1)
        self.filter1.grid(row=0, column=1, padx=10)
        self.filter2 = Button(frame_image,
                              text="Sepia",
                              padx=5,
                              pady=5,
                              state=DISABLED,
                              command=self.fil2)
        self.filter2.grid(row=0, column=2)
        self.filter3 = Button(frame_image,
                              text="Gray",
                              padx=5,
                              pady=5,
                              state=DISABLED,
                              command=self.fil3)
        self.filter3.grid(row=0, column=3, padx=10)
        self.filter4 = Button(frame_image,
                              text="Sharpening",
                              padx=5,
                              pady=5,
                              state=DISABLED,
                              command=self.fil4)
        self.filter4.grid(row=0, column=4)
        selected_filter = Label(frame_image,
                                text="Selected filter:").grid(row=1,
                                                              column=1,
                                                              columnspan=4)
        self.selected_filter_name = Label(frame_image,
                                          text="No Filter Selected")
        self.selected_filter_name.grid(row=2, column=1, columnspan=4)

        self.root.wm_protocol("WM_DELETE_WINDOW", self.onClose)
Beispiel #10
0
    def __init__(self, thread_cls):
        super().__init__()
        self.thread_cls = thread_cls
        self.img = None
        self.title("Emotion API")
        self.grid()
        self.grid_columnconfigure(0, weight=1)
        self.grid_columnconfigure(1, weight=2)
        self.grid_rowconfigure(4, weight=1)

        # Create LabelFrames
        lf_key = LabelFrame(self, text="Emotion API Key")
        lf_key.grid(row=0,
                    column=0,
                    columnspan=1,
                    sticky=W + E,
                    padx=5,
                    pady=3)
        lf_key.grid_columnconfigure(0, weight=1)
        lf_mode = LabelFrame(self, text="Mode")
        lf_mode.grid(row=1,
                     column=0,
                     columnspan=1,
                     sticky=W + E,
                     padx=5,
                     pady=3)
        for i in range(3):
            lf_mode.grid_columnconfigure(i, weight=1)
        lf_source = LabelFrame(self, text="Image Source", height=50)
        lf_source.grid(row=2,
                       column=0,
                       columnspan=1,
                       sticky=W + E,
                       padx=5,
                       pady=3)
        lf_source.rowconfigure(0, weight=1)
        lf_source.grid_propagate(False)
        lf_source.columnconfigure(0, weight=1)
        lf_source.columnconfigure(1, weight=5)
        lf_source.columnconfigure(2, weight=1)
        lf_request = LabelFrame(self, text="Request Result")
        lf_request.grid(row=3,
                        column=0,
                        columnspan=1,
                        sticky=W + E,
                        padx=5,
                        pady=3)
        lf_request.grid_columnconfigure(0, weight=1)
        lf_console = LabelFrame(self, text="Console")
        lf_console.grid(row=4,
                        column=0,
                        columnspan=1,
                        sticky=N + S + W + E,
                        padx=5,
                        pady=3)
        lf_console.grid_columnconfigure(0, weight=1)
        lf_console.grid_rowconfigure(0, weight=1)
        lf_img = LabelFrame(self, text="Output Image")
        lf_img.grid(row=0, column=1, rowspan=5, sticky=N + S + W + E)
        lf_img.grid_columnconfigure(0, weight=1)
        lf_img.grid_rowconfigure(0, weight=1)

        # Create Input Fields
        self.ety_key = Entry(lf_key)
        self.ety_key.insert(END, "bfe9b2f471e04b29a8fabfe3dd9f647d")
        self.ety_key.grid(sticky=W + E, padx=3)
        self.var_mode = StringVar()
        Radiobutton(lf_mode,
                    text="Local Image",
                    variable=self.var_mode,
                    value='local',
                    command=self.change_mode).grid(row=1, column=0)
        Radiobutton(lf_mode,
                    text="URL Image",
                    variable=self.var_mode,
                    value='url',
                    command=self.change_mode).grid(row=1, column=1)
        Radiobutton(lf_mode,
                    text="Camera",
                    variable=self.var_mode,
                    value='cam',
                    command=self.change_mode).grid(row=1, column=2)
        # Local Image Source
        self.lb_filename = Label(lf_source, text="..")
        self.btn_fileopen = Button(lf_source,
                                   text="Open..",
                                   command=self.get_local_img)
        # URL Image Source
        self.lb_url = Label(lf_source, text="URL")
        self.ety_url = Entry(lf_source)
        self.ety_url.insert(END, "https://i.imgflip.com/qiev6.jpg")
        self.btn_url = Button(lf_source,
                              text="Get Image",
                              command=self.get_url_img)
        # Camera Image Source
        self.btn_get_cam = Button(lf_source,
                                  text="Get the Camera Image",
                                  command=self.get_cam_img)
        # set default mode: local raw image
        self.var_mode.set('local')
        self.change_mode()
        # request btn
        self.btn_request = Button(lf_request,
                                  text="Request Result",
                                  command=self.run_request,
                                  state='disable')
        self.btn_request.grid(sticky=W + E)

        # Create Output Console
        self.console = ScrolledText(lf_console,
                                    state='disable',
                                    width=60,
                                    bg='gray20',
                                    fg='white')
        self.console.grid(sticky=N + S + W + E)

        # Create Output Image
        self.plot = ResultImg(lf_img)
        self.plot.grid(sticky=N + S + W + E)
Beispiel #11
0
    def create_general_form(self, tab):
        form = Frame(tab)
        center = LabelFrame(form, padx=90, pady=30, width=450, height=250)
        btm_frame = Frame(form, pady=3, width=450, height=40)

        # layout all of the main containers
        form.pack(fill=tk.BOTH, expand=True)
        center.pack(fill=tk.BOTH, expand=True)
        btm_frame.pack(side=tk.RIGHT, padx=5, pady=5)

        center.grid_propagate(False)
        btm_frame.pack_propagate(False)
        center.grid_rowconfigure(0, pad=20)
        center.grid_rowconfigure(1, pad=20)
        center.grid_columnconfigure(1, weight=2, pad=20)

        en_file = Entry(center, state='disabled', width=200)
        en_file.grid(row=0, column=1, columnspan=2, padx=5, sticky='W')

        # Center elements
        def open_file():
            en_file.config(state='normal')
            en_file.delete(0, 'end')
            en_file.config(state='disabled')
            file = filedialog.askopenfilename(
                initialdir=os.path.join(os.getcwd(), 'inputs'),
                title="Select file",
                filetypes=(("csv files", "*.csv"), ("XES files", "*.xes"),
                           ("all files", "*.*")))
            en_file.config(state='normal')
            en_file.insert(0, os.path.basename(file))
            en_file.config(state='disabled')

        b_select = Button(center, text="Select event-log", command=open_file)
        b_select.grid(row=0, sticky='W')
        self.general_form.append({'name': 'file', 'obj': en_file})

        lb_exec_mode = Label(center, text="Exec. Mode: ")
        lb_exec_mode.grid(row=1, sticky='W')
        cb_exec_mode = ttk.Combobox(center)
        cb_exec_mode.set('single')
        cb_exec_mode['values'] = ('single', 'optimizer')
        cb_exec_mode.grid(row=1, column=1, padx=5, sticky='W')
        self.general_form.append({'name': 'exec_mode', 'obj': cb_exec_mode})

        lb_eval_metric = Label(center, text="Evaluation metric: ")
        lb_eval_metric.grid(row=2, sticky='W')
        cb_eval_metric = ttk.Combobox(center)
        cb_eval_metric.set('tsd')
        cb_eval_metric['values'] = ('tsd', 'dl_mae', 'tsd_min', 'mae')
        cb_eval_metric.grid(row=2, column=1, padx=5, sticky='W')
        self.general_form.append({'name': 'sim_metric', 'obj': cb_eval_metric})

        lb_rep = Label(center, text="Repetitions: ")
        lb_rep.grid(row=3, sticky='W')
        var = tk.IntVar()
        sl_rep = Scale(center,
                       variable=var,
                       from_=1,
                       to=30,
                       resolution=1,
                       orient=tk.HORIZONTAL)
        sl_rep.grid(row=3, column=1, padx=5, sticky='W')
        self.general_form.append({'name': 'repetitions', 'obj': sl_rep})
        # Bottom elements
        b_ok = Button(btm_frame, text="Next", command=self.next_tab)
        b_ok.grid(row=0)
        form.pack(side=tk.TOP, fill=tk.X, padx=5, pady=5)
        return form
Beispiel #12
0
    def create_optimizer_form(self, tab):
        form = Frame(tab)
        center = LabelFrame(form, width=450, height=250, padx=50, pady=10)
        btm_frame = Frame(form, width=450, height=45, pady=3)

        # layout all of the main containers
        form.pack(fill=tk.BOTH, expand=True)
        center.pack(fill=tk.BOTH, expand=True)
        btm_frame.pack(side=tk.RIGHT, padx=5, pady=5)

        center.grid_propagate(False)
        btm_frame.pack_propagate(False)

        lb_eta = Label(center, text="Eta: ")
        varmin = tk.DoubleVar()
        varmax = tk.DoubleVar()
        sl_eta_min = tk.Scale(center,
                              variable=varmin,
                              from_=0,
                              to=1,
                              resolution=0.01,
                              orient=tk.HORIZONTAL,
                              label='min')
        sl_eta_max = tk.Scale(center,
                              variable=varmax,
                              from_=0,
                              to=1,
                              resolution=0.01,
                              orient=tk.HORIZONTAL,
                              label='max')
        sl_eta_max.set(1)
        lb_eta.grid(row=0, sticky='W')
        sl_eta_min.grid(row=0, column=1, padx=5, sticky='W')
        sl_eta_max.grid(row=0, column=2, padx=5, sticky='W')
        self.opt_form.append({'name': 'eta_min', 'obj': sl_eta_min})
        self.opt_form.append({'name': 'eta_max', 'obj': sl_eta_max})

        lb_epsilon = Label(center, text="Epsilon: ")
        varmin = tk.DoubleVar()
        varmax = tk.DoubleVar()
        sl_epsilon_min = tk.Scale(center,
                                  variable=varmin,
                                  from_=0,
                                  to=1,
                                  resolution=0.01,
                                  orient=tk.HORIZONTAL,
                                  label='min')
        sl_epsilon_max = tk.Scale(center,
                                  variable=varmax,
                                  from_=0,
                                  to=1,
                                  resolution=0.01,
                                  orient=tk.HORIZONTAL,
                                  label='max')
        sl_epsilon_max.set(1)
        lb_epsilon.grid(row=1, sticky='W')
        sl_epsilon_min.grid(row=1, column=1, padx=5, sticky='W')
        sl_epsilon_max.grid(row=1, column=2, padx=5, sticky='W')
        self.opt_form.append({'name': 'epsilon_min', 'obj': sl_eta_min})
        self.opt_form.append({'name': 'epsilon_max', 'obj': sl_eta_max})

        lb_rpool = Label(center, text="Res. Pool Sim: ")
        varmin = tk.DoubleVar()
        varmax = tk.DoubleVar()
        sl_rpool_min = tk.Scale(center,
                                variable=varmin,
                                from_=0,
                                to=1,
                                resolution=0.01,
                                orient=tk.HORIZONTAL,
                                label='min')
        sl_rpool_max = tk.Scale(center,
                                variable=varmax,
                                from_=0,
                                to=1,
                                resolution=0.01,
                                orient=tk.HORIZONTAL,
                                label='max')
        sl_rpool_min.set(0.5)
        sl_rpool_max.set(0.9)
        lb_rpool.grid(row=2, sticky='W')
        sl_rpool_min.grid(row=2, column=1, padx=5, sticky='W')
        sl_rpool_max.grid(row=2, column=2, padx=5, sticky='W')
        self.opt_form.append({'name': 'rpool_min', 'obj': sl_rpool_min})
        self.opt_form.append({'name': 'rpool_max', 'obj': sl_rpool_max})

        lb_eval = Label(center, text="Max. Evaluations: ")
        lb_eval.grid(row=3, sticky='W')
        var3 = tk.IntVar()
        sl_eval = tk.Scale(center,
                           variable=var3,
                           from_=1,
                           to=50,
                           resolution=1,
                           orient=tk.HORIZONTAL,
                           length=215)
        sl_eval.grid(row=3, column=1, columnspan=2, padx=5, sticky='W')
        self.opt_form.append({'name': 'max_eval', 'obj': sl_eval})

        # Bottom elements
        b_ok = Button(btm_frame, text="Execute", command=self.execute_opt)
        b_ok.grid(row=0, sticky='W')
        b_cancel = Button(btm_frame, text="Back", command=self.back)
        b_cancel.grid(row=0, column=1, sticky='W')

        form.pack(side=tk.TOP, fill=tk.X, padx=5, pady=5)
        return form
Beispiel #13
0
    def create_single_form(self, tab):
        form = Frame(tab)
        center = LabelFrame(form, width=450, height=250, padx=50, pady=20)
        btm_frame = Frame(form, width=450, height=45, pady=3)

        # layout all of the main containers
        form.pack(fill=tk.BOTH, expand=True)
        center.pack(fill=tk.BOTH, expand=True)
        btm_frame.pack(side=tk.RIGHT, padx=5, pady=5)

        center.grid_propagate(False)
        btm_frame.pack_propagate(False)
        center.grid_rowconfigure(5, pad=30)

        lb_eta = Label(center, text="Percentile for frequency (Eta): ")
        lb_eta.grid(row=0, sticky='W')
        var = tk.DoubleVar()
        sl_eta = Scale(center,
                       variable=var,
                       from_=0,
                       to=1,
                       resolution=0.01,
                       orient=tk.HORIZONTAL,
                       length=140)
        sl_eta.set(0.4)
        sl_eta.grid(row=0, column=1, columnspan=2, padx=5, sticky='W')
        self.single_form.append({'name': 'eta', 'obj': sl_eta})

        lb_epsilon = Label(center, text="Parallelism (Epsilon): ")
        lb_epsilon.grid(row=1, sticky='W')
        var2 = tk.DoubleVar()
        sl_epsilon = Scale(center,
                           variable=var2,
                           from_=0,
                           to=1,
                           resolution=0.01,
                           orient=tk.HORIZONTAL,
                           length=140)
        sl_epsilon.set(0.1)
        sl_epsilon.grid(row=1, column=1, columnspan=2, padx=5, sticky='W')
        self.single_form.append({'name': 'epsilon', 'obj': sl_epsilon})

        lb_gate = Label(center, text="Non-conformances management: ")
        lb_gate.grid(row=2, sticky='W')
        cb_gate = ttk.Combobox(center)
        cb_gate.set('removal')
        cb_gate['values'] = ('removal', 'replacement', 'repair')
        cb_gate.grid(row=2, column=1, padx=5, sticky='W')
        self.single_form.append({'name': 'alg_manag', 'obj': cb_gate})

        lb_pool = Label(center, text="Res. Pool Sim: ")
        lb_pool.grid(row=3, sticky='W')
        var3 = tk.DoubleVar()
        sl_pool = Scale(center,
                        variable=var3,
                        from_=0,
                        to=1,
                        resolution=0.01,
                        orient=tk.HORIZONTAL,
                        length=140)
        sl_pool.set(0.85)
        sl_pool.grid(row=3, column=1, columnspan=2, padx=5, sticky='W')
        self.single_form.append({'name': 'rp_similarity', 'obj': sl_pool})

        lb_gate = Label(center, text="Gateways discovery: ")
        lb_gate.grid(row=4, sticky='W')
        cb_gate = ttk.Combobox(center)
        cb_gate.set('discovery')
        cb_gate['values'] = ('discovery', 'random', 'equiprobable')
        cb_gate.grid(row=4, column=1, padx=5, sticky='W')
        self.single_form.append({'name': 'gate_management', 'obj': cb_gate})

        var4 = tk.BooleanVar()
        ck_semi = ttk.Checkbutton(center, variable=var4, text="Semi-automatic")
        ck_semi.grid(row=5, column=0, padx=5, sticky='W')
        self.single_form.append({'name': 'pdef_method', 'obj': var4})

        # Bottom elements
        b_ok = Button(btm_frame, text="Execute", command=self.execute_single)
        b_ok.grid(row=0, sticky='W')
        b_cancel = Button(btm_frame, text="Back", command=self.back)
        b_cancel.grid(row=0, column=1, sticky='W')

        form.pack(side=tk.TOP, fill=tk.X, padx=5, pady=5)
        return form