Exemplo n.º 1
0
    def __init__(self, master):
        # Top menu
        self.menu = Frame(master)
        self.menu.pack(fill='both', expand=True)

        self.save_button = Button(master, text='Save', command=self.save_grid)
        self.save_button.pack(in_=self.menu, side='right')

        self.load_button = Button(master, text='Load', command=self.load_grid)
        self.load_button.pack(in_=self.menu, side='right')

        # Place the canvas
        self.canvas = Canvas(master,
                             width=MAP_CELL_SIZE * MAP_SIZE,
                             height=MAP_CELL_SIZE * MAP_SIZE)

        self.grid = [[Cell(self.canvas, row, col) for col in range(MAP_SIZE)]
                     for row in range(MAP_SIZE)]
        self.plant_grid = [[None for col in range(MAP_SIZE)]
                           for row in range(MAP_SIZE)]

        self.canvas.bind("<Button-1>", self.event_set_cell)
        self.canvas.bind("<B1-Motion>", self.event_set_cell)

        self.canvas.pack()

        # Tools
        self.tools = Frame(master)
        self.tools.pack(fill='both', expand=True)

        self.fill_button = Button(self.tools,
                                  text="Fill",
                                  command=self.fill_grid)
        self.fill_button.pack(side='left')

        types = list(list_draw_types())
        self.draw_type = StringVar(master)
        self.draw_type.set(DEFAULT_CELL_TYPE)
        self.dd_draw_type = OptionMenu(self.tools, self.draw_type,
                                       DEFAULT_CELL_TYPE, *types)
        self.dd_draw_type.pack(side='left')

        self.symetry = StringVar(master)
        self.symetry.set(SYMETRY[0])
        self.dd_symetry = OptionMenu(self.tools, self.symetry, SYMETRY[0],
                                     *SYMETRY)
        self.dd_symetry.pack(side='right')

        self.draw()
Exemplo n.º 2
0
def settings():
    global settings_popup
    try: settings_popup.destroy()
    except: pass
    settings_styles = Style()
    settings_styles.configure(
        "SettingsLabelframe.TLabelframe.Label", font=("Verdana", 18, "normal"))
    settings_styles.configure(
        "SettingsLabelframe.TLabelframe.Label", foreground=COLORS['TEXTCOLOR'])

    settings_popup = Toplevel()
    settings_popup.title("Settings")
    settings_popup.transient(root)
    settings_popup.resizable(False, False)

    other_frame = LabelFrame(settings_popup, text="Settings", style="SettingsLabelframe.TLabelframe")
    basefreq_lbl = Label(other_frame, text="Octave")
    basefreq_om = OptionMenu(other_frame, OPTIONS['BASE_FREQ'], BASE_FREQS[-1], *BASE_FREQS)
    

    basefreq_lbl.grid(row=0, column=0, padx=5)
    basefreq_om.grid(row=0, column=1, padx=5)
    other_frame.pack(padx=15, pady=15, ipadx=5, ipady=5)

    settings_popup.mainloop()
Exemplo n.º 3
0
    def _addNeueMahlzeitFrame(self):
        self.fr_neue_mz = Frame(self.fr_mahlzeit)
        self.fr_neue_mz.grid_rowconfigure(2, weight=1)
        self.fr_neue_mz.grid(row=0, column=1, sticky="WSNE")

        lbl_name = Label(self.fr_neue_mz, text="Name:")
        lbl_name.grid(row=0, column=0, sticky="NW")

        self.en_name = Entry(self.fr_neue_mz)
        self.en_name.grid(row=0, column=1, columnspan=2, sticky="WNE")

        lbl_zutat = Label(self.fr_neue_mz, text="Zutaten:")
        lbl_zutat.grid(row=1, column=0, sticky="NW")

        self.lb_zutat = Listbox(self.fr_neue_mz)
        sb_zutat = Scrollbar(self.lb_zutat, orient=VERTICAL)
        self.lb_zutat.configure(yscrollcommand=sb_zutat.set)
        sb_zutat.configure(command=self.lb_zutat.yview)
        sb_zutat.pack(side="right", fill="both")
        self.lb_zutat.grid(row=2, column=0, columnspan=3, sticky="NWSE")

        self.var_zutat = StringVar(self.fr_neue_mz)

        self.opt_zutat = OptionMenu(self.fr_neue_mz, self.var_zutat, "Auswahl")
        self.opt_zutat.grid(row=3, column=0)

        self.en_menge = Entry(self.fr_neue_mz)
        self.en_menge.grid(row=3, column=1)

        self.btn_mahlzeit_hinzu = Button(self.fr_neue_mz, text="Hinzu")
        self.btn_mahlzeit_hinzu.grid(row=3, column=2, sticky="E")
Exemplo n.º 4
0
 def createWidgets(self):
     self.mainFrame = Frame(self.parent)
     Label(self.mainFrame, text="Puzzle Slider",
           font=('', 50)).pack(padx=10, pady=10)
     frame = Frame(self.mainFrame)
     Label(frame, text='Image').grid(sticky=W)
     Entry(frame, textvariable=self.image, width=50).grid(row=0,
                                                          column=1,
                                                          padx=10,
                                                          pady=10)
     Button(frame, text='Browse', command=self.browse).grid(row=0,
                                                            column=2,
                                                            pady=10)
     Label(frame, text='Grid').grid(sticky=W)
     OptionMenu(frame, self.grid, *[3, 4, 5, 6, 7, 8, 9, 10]).grid(row=1,
                                                                   column=1,
                                                                   padx=10,
                                                                   pady=10,
                                                                   sticky=W)
     frame.pack(padx=1, pady=10)
     Button(self.mainFrame, text="Start", command=self.start).pack(padx=10,
                                                                   pady=10)
     self.mainFrame.pack()
     self.board = Frame(self.parent)
     self.winFrame = Frame(self.parent)
     Label(self.winFrame, textvariable=self.winTex,
           font=('', 50)).pack(padx=10, pady=10)
     Button(self.winFrame, text='Play Again',
            command=self.playAgain).pack(padx=10, pady=10)
Exemplo n.º 5
0
 def update_def_cat_menu(self):
     self.def_cat_menu.destroy()
     categories = [l.cget('text') for l in self.cat_labels.values()]
     self.def_cat_menu = OptionMenu(self.frame_def_cat, self.default_category,
                                    None, *categories)
     optionmenu_patch(self.def_cat_menu, self.default_category)
     self.def_cat_menu.grid(row=0, column=1, sticky="w", padx=4, pady=4)
Exemplo n.º 6
0
 def valide(event=None):
     cats = [l.cget('text').lower() for l in self.cat_labels.values()]
     cat = name.get().strip().lower()
     if cat and cat not in cats:
         i = self.add_cat_button.grid_info()['row']
         self.add_cat_button.grid_configure(row=i + 1)
         self.cat_labels[cat] = Label(self.frame_cat,
                                      text="%s " % cat.capitalize())
         self.cat_labels[cat].grid(row=i, column=0, sticky="e")
         self.cat_colors[cat] = StringVar(self, _("Yellow"))
         self.cat_menus[cat] = OptionMenu(self.frame_cat, self.cat_colors[cat],
                                          _("Yellow"), *self.colors,
                                          command=lambda color, c=cat: self.change_menubutton_color(color, c),
                                          style="%s.TMenubutton" % cat)
         self.style.configure("%s.TMenubutton" % cat, background=COLORS[_("Yellow")])
         optionmenu_patch(self.cat_menus[cat], self.cat_colors[cat])
         self.cat_menus[cat].grid(row=i, column=1, padx=4, pady=4)
         self.cat_buttons[cat] = Button(self.frame_cat, image=self.im_moins,
                                        command=lambda c=cat: self.del_cat(c))
         self.cat_buttons[cat].grid(row=i, column=2, padx=4, pady=4)
         self.cat_buttons[self.categories[0]].configure(state="normal")
         self.categories.append(cat)
         self.categories.sort()
         self.update_def_cat_menu()
         top.destroy()
Exemplo n.º 7
0
    def create_widgets(self):
        self.dropdown_label = Label(self, text='Choose a type of graph')

        self.option_var = StringVar(self, name="option")
        self.option_var.set('Bar')
        self.option_var.trace('w', self.on_option_change)

        self.close_button = Button(self,
                                   text='Close Tab',
                                   command=self.close_tab)

        self.data = {
            'Country': ['US', 'CA', 'GER', 'UK', 'FR'],
            'GDP_Per_Capita': [45000, 42000, 52000, 49000, 47000]
        }
        self.data_frame = DataFrame(self.data)

        # self.plot = self.create_plot(self.plot_title, self.data_frame, self, self.option_var)
        self.plot = None

        self.options = ['Bar', 'Line']
        self.dropdown = OptionMenu(self, self.option_var, self.options[0],
                                   *self.options)

        self.close_button.pack(anchor=W)
        self.dropdown_label.pack(side=TOP, anchor=N)
        self.dropdown.pack(side=TOP, anchor=N)
Exemplo n.º 8
0
 def __init__(self,
              master,
              default="",
              command=None,
              values=[],
              inline=False,
              label="",
              **options):
     super().__init__(master)
     from tkinter import StringVar
     from tkinter.ttk import Frame, Label
     self.var = StringVar(self.master, value=default)
     self.inline = inline
     self.value = default
     self.command = [command]
     self.values = values
     self.widget = Frame(self.master, **options)
     if label != "":
         self.label = Label(self.widget, text=label)
         self.label.pack(side="left", fill="y")
     if inline:
         from tkinter.ttk import OptionMenu
         self.children = OptionMenu(master=self.widget,
                                    variable=self.var,
                                    command=self.callback,
                                    **options)
         self.children.set_menu(default, *values)
         self.children.pack(side="right", fill="both")
     else:
         self.children = {}
         for value in values:
             self.add_item(value)
Exemplo n.º 9
0
    def create_widgets(self):
        self.mainFrame = Frame(self.parent)
        Label(self.mainFrame, text='Sliding Puzzle',
              font=('', 50)).pack(padx=10, pady=10)
        frame = Frame(self.mainFrame)
        # Element for selecting Image for the sliding puzzle
        Label(frame, text='Image').grid(sticky=W)
        Entry(frame, textvariable=self.image, width=50).grid(row=0,
                                                             column=1,
                                                             padx=10,
                                                             pady=10)
        Button(frame, text='Browse', command=self.browse).grid(row=0,
                                                               column=2,
                                                               pady=10)
        # Size of the grid for the puzzle. Number of pieces = grid**2
        Label(frame, text='Grid').grid(sticky=W)
        OptionMenu(frame, self.grid, *[3, 3, 4, 5]).grid(row=1,
                                                         column=1,
                                                         padx=10,
                                                         pady=10,
                                                         sticky=W)
        # Number of random moves generated to shuffle the puzzle
        Label(frame, text='Shuffle').grid(sticky=W)
        OptionMenu(frame, self.shuffle, *[200, 100, 200, 300, 400,
                                          500]).grid(row=2,
                                                     column=1,
                                                     padx=10,
                                                     pady=10,
                                                     sticky=W)
        # Seed for shuffling the sliding puzzle
        Label(frame, text='Seed').grid(sticky=W)
        Entry(frame, textvariable=self.seed, width=5).grid(row=3,
                                                           column=1,
                                                           padx=10,
                                                           pady=10,
                                                           sticky=W)

        frame.pack()
        Button(self.mainFrame, text='Start', command=self.start).pack(padx=10,
                                                                      pady=10)
        self.mainFrame.pack()
        self.board = Frame(self.parent)
        self.winFrame = Frame(self.parent)
        Label(self.winFrame, textvariable=self.win_text,
              font=('', 50)).pack(padx=10, pady=10)
        Button(self.winFrame, text='Play Again',
               command=self.play_again).pack(padx=10, pady=10)
Exemplo n.º 10
0
 def add_set_selector(self, model_variable, standard, wild):
     set_selector = OptionMenu(self, model_variable, "Card Set", *standard,
                               *wild)
     # Fix for multi-menu bug
     optionmenu_patch(set_selector, model_variable)
     set_selector['menu'].insert_separator(len(standard))
     set_selector.grid(row=2, column=1, columnspan=2, pady=20)
     self.set_selector = set_selector
Exemplo n.º 11
0
 def refresh_categories(self, category_list):
     """Refresh the category drop-down menu. This is called after configuring categories in the preferences"""
     self.category_list = category_list
     self.category_select = OptionMenu(self.expense_tab,
                                       self.chosen_category,
                                       self.category_list[0],
                                       *self.category_list)
     self.category_select.grid(row=1, column=3, pady=5, sticky="ew")
Exemplo n.º 12
0
    def create_main_frame(self):
        #create main frame and labels and buttons
        self.mainFrame = Frame(self.parent, background='Rosy Brown1')
        Label(self.mainFrame,
              text='N-Puzzle Game and AI',
              font=("Courier", 40, "bold"),
              fg='Pale Violet Red3',
              background='Rosy Brown2').pack(padx=10, pady=10)
        frame = Frame(self.mainFrame, background='Rosy Brown1')
        Entry(frame, textvariable=self.image, width=50).grid(row=1,
                                                             column=1,
                                                             padx=10,
                                                             pady=10,
                                                             sticky=W)
        Button(frame, text='Choose Image', command=self.browse).grid(row=0,
                                                                     column=2,
                                                                     pady=10,
                                                                     padx=10)
        OptionMenu(frame, self.grid, *[2, 3, 4, 5]).grid(row=1,
                                                         column=1,
                                                         padx=10,
                                                         pady=10,
                                                         sticky=W)
        frame.pack()
        Button(self.mainFrame, text='Let\'s Play!',
               command=self.start).pack(padx=10, pady=10)
        Button(self.mainFrame,
               text='Get AI Solution A*',
               command=self.play_ai_ast).pack(padx=10, pady=10)
        Button(self.mainFrame,
               text='Get AI Solution BFS',
               command=self.play_ai_bfs).pack(padx=10, pady=10)
        Button(self.mainFrame,
               text='Get AI Solution DFS',
               command=self.play_ai_dfs).pack(padx=10, pady=10)
        self.mainFrame.pack()

        #create board frame after the game has started
        self.board = Frame(self.parent)

        #create win frame
        self.winFrame = Frame(self.parent, background='Rosy Brown1')
        Label(self.winFrame,
              textvariable=self.winText,
              font=("Courier", 40, "bold"),
              fg='Pale Violet Red3',
              background='Rosy Brown2').pack(padx=10, pady=10)
        Button(self.winFrame, text='Play Again',
               command=self.play_again).pack(padx=10, pady=10)
        Button(self.winFrame,
               text='Get AI Solution A*',
               command=self.play_ai_ast).pack(padx=10, pady=10)
        Button(self.winFrame,
               text='Get AI Solution BFS',
               command=self.play_ai_bfs).pack(padx=10, pady=10)
        Button(self.winFrame,
               text='Get AI Solution DFS',
               command=self.play_ai_dfs).pack(padx=10, pady=10)
Exemplo n.º 13
0
 def add_peak_selector(self, poss):
     self.poss = poss
     if self.curMenu != None:
         self.curMenu.destroy()
     self.selected = StringVar(self.controller)
     self.selected.set("Select Element")
     opts = ["Select Element"] + [p[0]+": "+str(p[1]) for p in poss] #Stupid tkinter workaround
     self.curMenu = OptionMenu(self,self.selected,*opts)
     self.curMenu.grid(row=2, column = 5)
Exemplo n.º 14
0
    def set_widgets(self):
        self.operationChoice = StringVar(self, self.operations[0])
        self.shape = StringVar(self, value=self.shapes[0])
        self.size = StringVar(self, value="3")
        self.borderType = StringVar(self, list(self.handleBorder.keys())[0])

        self.operationChoice.trace("w", self.update_preview)
        self.shape.trace("w", self.update_preview)
        self.borderType.trace("w", self.update_preview)

        self.operationList = OptionMenu(self, self.operationChoice)
        self.shapeList = OptionMenu(self, self.shape)
        self.sizeSpin = Spinbox(self,
                                justify='center',
                                font=("Helvetica", 15),
                                from_=3,
                                to=9999,
                                textvariable=self.size,
                                command=self.update_preview,
                                state='readonly',
                                increment=2)
        self.borderList = OptionMenu(self, self.borderType)

        for oper in self.operations:
            self.operationList['menu'].add_command(
                label=oper, command=lambda v=oper: self.operationChoice.set(v))

        for sh in self.shapes:
            self.shapeList['menu'].add_command(
                label=sh, command=lambda v=sh: self.shape.set(v))

        for border in self.handleBorder:
            self.borderList['menu'].add_command(
                label=border, command=lambda v=border: self.borderType.set(v))

        self.saveButton = Button(self,
                                 image=saveIcon,
                                 command=self.update_image)
        self.cancelButton = Button(self, image=closeIcon, command=self.cancel)

        self.update_preview()
        self.place_widgets()
Exemplo n.º 15
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        # Window settings
        self.minsize(width=1050, height=800)
        self.maxsize(width=1050, height=800)
        self.resizable(width=False, height=False)
        self.protocol("WM_DELETE_WINDOW", self.quit)
        self.title("Labyrinth Solver - by Frank Fourlas")

        # Sidebar
        sidebar = Frame(self, bg='grey')

        Button(sidebar, text='Run Algorithm', command=self.run_algorithm, height=2, font=25).pack(side=TOP, padx=10,
                                                                                                  pady=10)
        self.h_func = StringVar()
        self.h_func.set('eucledean')
        OptionMenu(sidebar, self.h_func, 'eucledean', *['eucledean', 'manhatan']).pack(side=TOP, padx=10, pady=10)

        Button(sidebar, text='Reset Maze', command=self.reset_maze, height=2, font=25).pack(side=TOP, padx=10, pady=10)

        Button(sidebar, text='Save Maze', command=self.save_maze, height=2, font=25).pack(side=TOP, padx=10, pady=10)
        Button(sidebar, text='Load Maze', command=self.load_maze, height=2, font=25).pack(side=TOP, padx=10, pady=10)

        self.display_weights = BooleanVar()
        self.display_weights.set(1)
        Checkbutton(sidebar, text='Display Weights', variable=self.display_weights).pack(side=TOP, padx=10, pady=10)

        multiplier = Frame(sidebar)
        Label(multiplier, text='h Function multiplier').pack(side=TOP, padx=10, pady=2)
        radio = Frame(multiplier)
        self.h_mul = DoubleVar()
        self.h_mul.set(1)
        Radiobutton(radio, text='1/4', variable=self.h_mul, value=0.25).pack(side=LEFT, padx=2, pady=5)
        Radiobutton(radio, text='1/2', variable=self.h_mul, value=0.5).pack(side=LEFT, padx=2, pady=5)
        Radiobutton(radio, text='1', variable=self.h_mul, value=1).pack(side=LEFT, padx=2, pady=5)
        Radiobutton(radio, text='3', variable=self.h_mul, value=3).pack(side=LEFT, padx=2, pady=5)
        Radiobutton(radio, text='15', variable=self.h_mul, value=15).pack(side=LEFT, padx=2, pady=5)
        radio.pack(side=TOP, padx=2, pady=2)
        multiplier.pack(side=TOP, padx=10, pady=10)

        sidebar.pack(side=LEFT, fill=Y)

        # Labyrinth
        self.reset_maze()

        # Canvas
        self.canvas = Canvas(self, bg='#a0ff8f')
        self.canvas.bind("<Button-1>", self.canvas_click)
        self.canvas.pack(side=LEFT, expand=True, fill=BOTH)
        self.update_canvas()

        self.RUNNING = True
        self.ALGORITHM = False
Exemplo n.º 16
0
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)

        # Menu bar
        self.nav_button1 = tk.Button(self, text='Execute', command=lambda: controller.show_frame(RunWindow))
        self.nav_button1.grid(row=1, column=1, sticky='ew')
        self.nav_button2 = tk.Button(self, text='Remove', command=delete)
        self.nav_button2.grid(row=1, column=2, sticky='ew')
        self.nav_button3 = tk.Button(self, text='Email', command=email)
        self.nav_button3.grid(row=1, column=3, sticky='ew')
        self.nav_button4 = tk.Button(self, text='About', command=about)
        self.nav_button4.grid(row=1, column=4, sticky='ew')

        # Body of Install Window
        self.description_label = tk.Label(self, text='FSS NOC Tool Installer', font='Helvetica 18 bold',
                                          anchor='center', background='#0033A0', foreground='white', relief='sunken')
        self.description_label.grid(row=2, column=1, columnspan=4, sticky='ew')
        self.tools = [' Make your selection ',
                      'Rounding Laptop Tool',
                      'SnIPT Tool',
                      'UPS Generator',
                      'Timezone Conversion',
                      'SAP Tool',
                      'Remote GPUpdate',
                      'Legal Hold Tool',
                      'RL Last Logon',
                      'Printer Tool',
                      'Hostname Converter',
                      'Data Transfer Tool',
                      'Timezone Changer']
        self.tool_label = tk.StringVar(self)
        self.opt_menu = OptionMenu(self, self.tool_label, *sorted(self.tools))
        self.opt_menu.grid(row=4, column=1, columnspan=4, sticky='ew', pady=20)
        self.tool_label.trace('w', self.tool_selection)
        self.start = 'This tool will install all the selected programs to your local system. ' \
                     'Please select the item you need and then click Install.\n\n ' \
                     'Please provide any issues, or requests to [email protected]'
        self.tool_description = tk.Label(self, text=self.start, foreground='grey', relief='sunken',
                                         wraplength=375, justify='left')
        self.tool_description.grid(row=5, column=1, columnspan=4, sticky='ew', padx=10, pady=5)

        # Action Buttons
        self.tool = tk.Button(self, text='Install', background='green', height=4, width=10, command=self.tool_install)
        self.tool.grid(row=6, column=1, columnspan=2, padx=10, pady=20)
        self.cancel = tk.Button(self, text='Cancel', background='red', height=4, width=10, command=self.quit)
        self.cancel.grid(row=6, column=3, columnspan=2, padx=10, pady=20)

        # Status Bar
        self.progress = tk.Label(self, text='', relief='sunken', anchor='w', )
        self.progress.grid(row=7, column=1, columnspan=4, sticky='sew', pady=5)
Exemplo n.º 17
0
    def set_widgets(self):
        self.firstChoice = StringVar(self)
        self.secondChoice = StringVar(self)
        self.operationChoice = StringVar(self)

        self.firstImageList = OptionMenu(self, self.firstChoice)
        self.secondImageList = OptionMenu(self, self.secondChoice)
        self.operationList = OptionMenu(self, self.operationChoice)

        self.update_list()
        self.operationChoice.set(self.operations[0])
        for oper in self.operations:
            self.operationList['menu'].add_command(
                label=oper, command=lambda v=oper: self.operationChoice.set(v))

        self.cbVal = IntVar()
        self.cb = Checkbutton(self, width=0, variable=self.cbVal)

        self.saveButton = Button(self,
                                 image=saveIcon,
                                 command=self.update_image)
        self.cancelButton = Button(self, image=closeIcon, command=self.cancel)

        self.place_widgets()
Exemplo n.º 18
0
 def createWidgests(self):
     self.mainFrame = Frame(self.parent)
     Label(self.mainFrame,text='8 puzzle',font=('',50)).pack(padx=10,pady=10)
     frame = Frame(self.mainFrame)
     Label(frame,text='Imagen').grid(sticky = W)
     Entry(frame,textvariable = self.image,width = 50).grid(row=0, column = 1, padx = 10, pady = 10)
     Button(frame,text='Buscar',command = self.browse).grid(row = 0, column = 2, pady = 10)
     Label(frame,text='Grid').grid(sticky = W)
     OptionMenu(frame,self.grid,*[2,3]).grid(row=1, column = 1, padx = 10, pady = 10,sticky = W)
     frame.pack(padx = 10, pady = 10)
     Button(self.mainFrame,text='Iniciar',command=self.start).pack(padx = 10, pady = 10)
     self.mainFrame.pack()
     self.board = Frame(self.parent)
     self.winFrame = Frame(self.parent)
     Label(self.winFrame,textvariable = self.winText,font = ('',50)).pack(padx = 10, pady = 10)
     Button(self.winFrame,text="Jugar Denuevo", command = self.playAgain).pack(padx = 10, pady = 10)
Exemplo n.º 19
0
    def __init__(self, *args, **kwargs):
        super().__init__(args[0], **kwargs)
        self.algs = args[1]

        # Блок выбора алгоритма
        self.frm_alg = Frame(self)
        self.frm_alg.pack(side=TOP)
        # Заголовок
        self.lbl_alg = Label(self.frm_alg, text="Алгоритм:")
        self.lbl_alg.pack(side=LEFT)
        # Выбор алгоритма
        self.cur_alg = StringVar()
        self.cur_alg.trace("w", self.alg_changed)
        self.ddl_alg = OptionMenu(self.frm_alg, self.cur_alg,
                                  *list(self.algs.keys()))
        self.ddl_alg.pack(side=LEFT)
Exemplo n.º 20
0
    def Dropdown(self, options, x, y, value=None, **kw):
        kw = var_check(kw)

        if value is not None: value1 = value
        else: value1 = options[0]
        if isinstance(value1, str): self.widget_frame.value1 = StringVar()
        else: self.widget_frame.value1 = DoubleVar()
        self.widget_frame.value1.set(value1)

        self.widget_frame.dropdown_options = OptionMenu(
            self.widget_frame, self.widget_frame.value1, *options)
        self.widget_frame.dropdown_options.place(relx=x,
                                                 rely=y,
                                                 anchor=kw['anchor'],
                                                 relwidth=kw['relwidth'],
                                                 relheight=kw['relheight'])

        return self.widget_frame.value1
Exemplo n.º 21
0
    def __init__(self, parent=None):
        Frame.__init__(self, parent)
        self.parent = parent
        self.parent.title("Partlocater - Manual Add")

        self.parent.iconbitmap(self.FAVICON)
         
        self.manual_frame = LabelFrame(self, text="Add Component")
        self.manual_frame.pack(side=TOP, fill=BOTH, expand=YES, pady=4, padx=4)
        self.prop_frame = []
        self.propvalue = []
        for item in self.PROPLIST:
            self.prop_frame.append(Frame(self.manual_frame))
            self.prop_frame[-1].pack(side=TOP, fill=X, expand=YES)
            prop_label = Label(self.prop_frame[-1], anchor=E, text=item, width=20)
            prop_label.pack(side=LEFT, anchor=E, fill=X, expand=YES, pady=4)
            self.propvalue.append(StringVar())
            if item != "Category":
                prop_entry = Entry(self.prop_frame[-1], textvariable=self.propvalue[-1], state=NORMAL, width=30)
                prop_entry.pack(side=LEFT, fill=X, expand=YES, pady=4, padx=4)
                self.propvalue[-1].trace("w", self.check_minentry)
            else:
                self.cat_entry = Entry(self.prop_frame[-1], textvariable=self.propvalue[-1], state=DISABLED, width=40)
                self.cat_entry.pack(side=LEFT, fill=X, expand=YES, pady=4, padx=4)
                if (item.startswith("Manufacturer")): 
                    self.propvalue[-1].trace("w", self.check_minentry)
                self.cat_option = StringVar()
                table_list = ['Capacitors'] + Config().tables
                cat_menu = OptionMenu(self.prop_frame[-1], self.cat_option, *table_list, command=self.on_category)
                cat_menu.pack(side=TOP, anchor=N, fill=X, expand=YES)

        self.button_frame = Frame(self.manual_frame)
        self.button_frame.pack(side=TOP, fill=X, expand=NO)
        self.clear_button = ttk.Button(self.button_frame, text="Clear", command=self.do_clear, state=NORMAL, width=8)
        self.clear_button.pack(side=RIGHT, anchor=W, fill=X, expand=NO)
        self.commit_button = ttk.Button(self.button_frame, text="Add", command=self.do_commit, state=DISABLED, width=8)
        self.commit_button.pack(side=RIGHT, anchor=W, fill=X, expand=NO)
        self.status_frame = LabelFrame(self, text="Status")
        self.status_frame.pack(side=BOTTOM, fill=X, expand=YES, pady=4, padx=6)
        self.status = self.StatusBar(self.status_frame, self)
        self.status.set("Set Category")

        self.pack(side=LEFT, fill=BOTH, expand=YES)
Exemplo n.º 22
0
    def __init__(self, window):
        super(Themes, self).__init__(window)

        self.window = window
        self.title("PyCreator - Themes")

        title = Label(self, text="Choisissez le thème")
        liste_themes = [self.window.theme]
        for i in Style().theme_names():
            if i not in liste_themes:
                liste_themes.append(i)
        self.v = StringVar()
        self.v.set(liste_themes[0])
        om = OptionMenu(self, self.v, *liste_themes)
        b = Button(self, text="Valider", command=self.validate)

        title.pack(padx=10, pady=10)
        om.pack(padx=10, pady=5)
        b.pack(padx=10, pady=5)
Exemplo n.º 23
0
 def add_peak_selectors(self, peaks, poss, variances):
     for o in self.newObjects:
         o.destroy()
     self.newObjects = []
     self.selected = []
     self.peaks = peaks
     self.variances = variances
     centers = peaks[::3]
     for i in range(len(centers)):
         self.selected.append(StringVar(self.controller))
     self.poss = poss
     for i in range(len(centers)):
         self.selected[i].set("Ignore")
         opts = ["","Ignore"] + [j[0]+": "+str(j[1]) for j in poss[i]] #Stupid tkinter workaround
         #TODO: Dicts of these?
         copy = i
         temp = Label(self,text=str(centers[i]))
         temp.grid(row=i+2, column = 4)
         self.newObjects.append(temp)
         temp=OptionMenu(self,self.selected[copy],*opts)
         temp.grid(row=i+2, column = 5)
         self.newObjects.append(temp)
Exemplo n.º 24
0
 def __init__(self, properties: LabelFrame) -> None:
     self.frame = Frame(properties)
     Label(self.frame, text='X').grid(column=0,
                                      row=0,
                                      sticky='E',
                                      pady=App.PADDING)
     self.position_x = StringVar(self.frame)
     self.position_x.set(App.DEFAULT_SIGN_WIDTH / 2)
     Spinbox(self.frame,
             to=App.MAX_SHEET_WIDTH,
             textvariable=self.position_x,
             width=App.SPINBOX_WIDTH).grid(column=1, row=0, sticky='W')
     Label(self.frame, text='Y').grid(column=0,
                                      row=1,
                                      sticky='E',
                                      pady=App.PADDING)
     self.position_y = StringVar(self.frame)
     self.position_y.set(App.DEFAULT_SIGN_HEIGHT / 2)
     Spinbox(self.frame,
             to=App.MAX_SHEET_HEIGHT,
             textvariable=self.position_y,
             width=App.SPINBOX_WIDTH).grid(column=1, row=1, sticky='W')
     Label(self.frame, text='Font size').grid(column=0,
                                              row=2,
                                              sticky='E',
                                              pady=App.PADDING)
     self.size = StringVar(self.frame)
     self.size.set(App.DEFAULT_SIGN_HEIGHT / 2)
     Spinbox(self.frame,
             to=App.MAX_SHEET_HEIGHT,
             textvariable=self.size,
             width=App.SPINBOX_WIDTH).grid(column=1, row=2, sticky='W')
     Label(self.frame, text='Align').grid(column=0,
                                          row=3,
                                          sticky='E',
                                          pady=App.PADDING)
     self.align = StringVar(self.frame)
     OptionMenu(self.frame, self.align, Text.ALIGN_OPTIONS[4],
                *Text.ALIGN_OPTIONS).grid(column=1, row=3, sticky='W')
Exemplo n.º 25
0
    def reset(self):
        '''
        new files should default to not showing dicom unless it has already been processed
        '''
        # hide frame navigation widgets
        # self.grid_remove()

        self.zframe.shown = False
        self.zframe.setImage(None)
        self.frame.destroy()
        self.frame = Frame(self.frame_holder)
        self.frame.pack(expand=True)
        self.reader = None

        if self.app.Data.getFileLevel('.dicom'):
            self.mode = 'dicom'
        elif self.app.Data.getFileLevel('.ult'):
            self.mode = 'ult'
        else:
            self.mode = None

        self.method.set('')
        options = [x.label for x in READERS[self.mode]] or ['[no ultrasound]']
        self.methodMenu = OptionMenu(self.frame,
                                     self.method,
                                     '---',
                                     *options,
                                     command=self.chooseMethod)
        self.methodMenu.grid(row=0)
        self.loadBtn = Button(self.frame,
                              text='Load frames',
                              command=self.load,
                              takefocus=0,
                              state='disabled')
        self.loadBtn.grid(row=1)
        if len(READERS[self.mode]) == 1:
            self.method.set(options[0])
            self.chooseMethod()
Exemplo n.º 26
0
    def config_buttons(self):
        """
        config_buttons 

        Define the interactive Buttons used for the GUI App
        """
        # Open File Browser Button
        self.btn_open_files = Button(self.buttons_frame,
                                     command=self.browseFiles,
                                     text='Select Videos')
        self.btn_open_files.grid(row=0, column=0, padx=(10), pady=10)

        # Dropdown Selector button
        self.var_open_files = StringVar(self.buttons_frame)
        self.dropdown_button = OptionMenu(self.buttons_frame,
                                          self.var_open_files, *self.CHOICES)
        self.dropdown_button.grid(row=0, column=1, padx=(10), pady=10)

        # Convert Button
        self.btn_convert = Button(self.buttons_frame,
                                  text='Convert',
                                  command=self.convert_video)
        self.btn_convert.grid(row=0, column=2, padx=(10), pady=10)
Exemplo n.º 27
0
    def __init__(self):
        self.root = ThemedTk(theme="radiance")
        INIT_WIDTH, INIT_HEIGHT = self.root.winfo_screenwidth(
        ), self.root.winfo_screenheight()
        boldStyle = ttk.Style()
        boldStyle.configure("Bold.TButton", font=('Sans', '12', 'bold'))
        #icon_loc = os.path.join(os.getcwd(),ICON_NAME)
        #img = ImageTk.PhotoImage(master = self.root, file=icon_loc)
        #self.root.wm_iconbitmap(img)
        #self.root.ttk.call('wm', 'iconphoto', self.root._w, img)
        self.root.title("Form Labeller")
        self.root.maxsize(INIT_WIDTH, INIT_HEIGHT)
        self.supported_formats = SUPPORTED_FORMATS

        self.left_frame = Frame(self.root, width=BUTTON_WIDTH)
        self.top_frame1 = Frame(self.left_frame,
                                width=BUTTON_WIDTH,
                                height=int(INIT_HEIGHT / 2))
        self.top_frame = Frame(self.left_frame,
                               width=BUTTON_WIDTH,
                               height=INIT_HEIGHT - int(INIT_HEIGHT / 2))
        self.bottom_frame = Frame(self.root, width=INIT_WIDTH - BUTTON_WIDTH)

        self.load_image_directory_button = Button(self.top_frame1,
                                                  text='Open Folder',
                                                  command=self.load_directory,
                                                  width=int(BUTTON_WIDTH),
                                                  style="Bold.TButton")
        self.load_image_directory_button.grid(row=OPEN_FOLDER_ROW,
                                              columnspan=2,
                                              sticky=tk.W + tk.E)

        self.prev_img_button = Button(self.top_frame1,
                                      text='← Prev',
                                      command=self.previous_img,
                                      state=tk.DISABLED,
                                      width=int(BUTTON_WIDTH / 2),
                                      style="Bold.TButton")
        self.prev_img_button.grid(row=PREV_ROW, column=0, sticky=tk.W + tk.E)

        self.next_img_button = Button(self.top_frame1,
                                      text='Next → ',
                                      command=self.next_img,
                                      width=int(BUTTON_WIDTH / 2),
                                      style="Bold.TButton")
        self.next_img_button.grid(row=NEXT_COL, column=1, sticky=tk.W + tk.E)

        self.save_image_button = Button(self.top_frame1,
                                        text='Save ',
                                        command=self.saver,
                                        width=int(BUTTON_WIDTH),
                                        style="Bold.TButton")
        self.save_image_button.grid(row=SAVE_ROW,
                                    columnspan=2,
                                    sticky=tk.W + tk.E)

        self.delete_poly_button = Button(self.top_frame,
                                         text='Delete Selected',
                                         command=self.delete_selected,
                                         width=int(BUTTON_WIDTH),
                                         style="Bold.TButton")
        self.delete_poly_button.grid(row=DEL_SELECTED_ROW,
                                     columnspan=2,
                                     sticky=tk.W + tk.E)

        self.type_choices = TYPE_CHOICES
        self.variable = StringVar(self.top_frame)
        self.variable.set(self.type_choices[0])
        self.type_options = OptionMenu(self.top_frame,
                                       self.variable,
                                       *self.type_choices,
                                       style="Bold.TButton")
        self.type_options.config(width=int(BUTTON_WIDTH / 2))
        self.type_options.grid(row=DROP_DOWN_ROW, column=0)

        self.save_type_button = Button(self.top_frame,
                                       text='Save Type',
                                       command=self.save_type,
                                       width=int(BUTTON_WIDTH / 2),
                                       style="Bold.TButton")
        self.save_type_button.grid(row=SAVE_TYPE_ROW,
                                   column=1,
                                   sticky=tk.W + tk.E)

        self.deselect_all_button = Button(self.top_frame,
                                          text='Deselect All',
                                          command=self.deselect_all,
                                          width=BUTTON_WIDTH,
                                          style="Bold.TButton")
        self.deselect_all_button.grid(row=DESELECT_ALL_ROW,
                                      columnspan=2,
                                      sticky=tk.W + tk.E)

        self.select_all_button = Button(self.top_frame,
                                        text='Select All',
                                        command=self.select_all,
                                        width=BUTTON_WIDTH,
                                        style="Bold.TButton")
        self.select_all_button.grid(row=SELECT_ALL_ROW,
                                    columnspan=2,
                                    sticky=tk.W + tk.E)

        self.draw_poly_button = Button(self.top_frame,
                                       text='Draw Poly',
                                       command=self.draw_poly_func,
                                       width=BUTTON_WIDTH,
                                       style="Bold.TButton")
        self.draw_poly_button.grid(row=DRAW_POLY_ROW,
                                   columnspan=2,
                                   sticky=tk.W + tk.E)

        self.draw_rect_button = Button(self.top_frame,
                                       text='Draw Rectangle',
                                       command=self.draw_rect_func,
                                       width=BUTTON_WIDTH,
                                       style="Bold.TButton")
        self.draw_rect_button.grid(row=DRAW_RECT_ROW,
                                   columnspan=2,
                                   sticky=tk.W + tk.E)

        self.delete_all_button = Button(self.top_frame,
                                        text='Delete All',
                                        command=self.delete_all,
                                        width=BUTTON_WIDTH,
                                        style="Bold.TButton")

        self.save_poly_button = Button(self.top_frame,
                                       text='Save Poly',
                                       command=self.save_drawing,
                                       width=int(BUTTON_WIDTH / 2),
                                       style="Bold.TButton")

        self.discard_poly_button = Button(self.top_frame,
                                          text='Discard Poly',
                                          command=self.discard_drawing,
                                          width=int(BUTTON_WIDTH / 2),
                                          style="Bold.TButton")

        self.save_rect_button = Button(self.top_frame,
                                       text='Save Rect',
                                       command=self.save_drawing,
                                       width=int(BUTTON_WIDTH / 2),
                                       style="Bold.TButton")

        self.discard_rect_button = Button(self.top_frame,
                                          text='Discard Rect',
                                          command=self.discard_drawing,
                                          width=int(BUTTON_WIDTH / 2),
                                          style="Bold.TButton")

        self.show_type_button = Button(self.top_frame,
                                       text='Show Type',
                                       command=self.show_type,
                                       width=int(BUTTON_WIDTH / 2),
                                       style="Bold.TButton")
        self.show_type_button.grid(row=SHOW_TYPE_ROW,
                                   column=0,
                                   columnspan=1,
                                   sticky=tk.W + tk.E)

        self.hide_type_button = Button(self.top_frame,
                                       text='Hide Type',
                                       command=self.hide_type,
                                       width=int(BUTTON_WIDTH / 2),
                                       style="Bold.TButton")
        self.hide_type_button.grid(row=HIDE_TYPE_ROW,
                                   columnspan=1,
                                   column=1,
                                   sticky=tk.W + tk.E)

        self.make_tight_button = Button(self.top_frame,
                                        text='Make Tight',
                                        command=self.make_tight,
                                        width=int(BUTTON_WIDTH / 2),
                                        style="Bold.TButton")
        self.make_tight_button.grid(row=MAKE_TIGHT_ROW,
                                    columnspan=2,
                                    column=0,
                                    sticky=tk.W + tk.E)

        self.threshold_scale = Scale(self.top_frame,
                                     from_=0,
                                     to=255,
                                     orient=HORIZONTAL,
                                     width=int(BUTTON_WIDTH / 2),
                                     label="Binary Threshold")
        self.threshold_scale.set(128)
        self.threshold_scale.grid(row=THRESHOLD_ROW,
                                  columnspan=2,
                                  column=0,
                                  sticky=tk.W + tk.E)

        self.tight_save_button = Button(self.top_frame,
                                        text='Accept Tight',
                                        command=self.save_tight)

        self.tight_discard_button = Button(self.top_frame,
                                           text='Discard Tight',
                                           command=self.discard_tight)

        self.canvas = Canvas(self.bottom_frame,
                             width=INIT_WIDTH - BUTTON_WIDTH,
                             height=INIT_HEIGHT,
                             borderwidth=1)
        self.image_name = None
        #self.image_path = os.path.join('imgs','img1.jpg')
        self.image_dir = None
        self.images_in_dir = None
        self.curr_idx = None
        self.img_cnv = None
        #self.img_cnv = ImageOnCanvas(self.root,self.canvas,self.image_path)
        self.drawing_obj = None
        self.tight_box_obj = None

        self.left_frame.pack(side=tk.LEFT)
        self.top_frame1.pack(side=tk.TOP)
        self.top_frame.pack(side=tk.BOTTOM)
        self.bottom_frame.pack(side=tk.LEFT)
        self.canvas.pack()
        self.hide_buttons()
        self.load_image_directory_button.config(state="normal")
Exemplo n.º 28
0
    def __init__(self, parent):
        """ Initialize Main Application """
        Frame.__init__(self, parent)

        # create a style object
        style = Style()
        style.configure('D.TButton', foreground='red3')
        style.configure('R.TButton',
                        foreground='DodgerBlue4',
                        font=("TkTextFont", 9, 'bold'))
        style.configure('B.TButton',
                        foreground='FireBrick4',
                        font=("TkTextFont", 9, 'bold'))

        # Left frame, column 1
        left_frame = Frame(master=self)
        left_frame.grid(row=1, column=1, padx=30, pady=35, rowspan=3)

        # Middle frame (info text, column 2)
        middle_frame = Frame(master=self)
        middle_frame.grid(row=1, column=2, padx=30, pady=35, rowspan=3)

        # Right frame (statistics, column 3)
        right_frame = Frame(master=self)
        right_frame.grid(row=1, column=3, padx=30, pady=35, rowspan=2)

        # LEFT FRAME WIDGET
        Label(left_frame, text="Book ID",
              font=("TkTextFont", 11)).grid(row=1, column=1, columnspan=3)
        self._book_list = Listbox(left_frame,
                                  height=10,
                                  width=10,
                                  font=("TkTextFont", 11),
                                  bg='LightSalmon2')
        self._book_list.grid(row=2, column=1)
        self._book_list.configure(justify="center")

        # Call this on select
        self._book_list.bind("<<ListboxSelect>>", self._update_textbox)

        # MIDDLE FRAME WIDGET
        Label(middle_frame, text="Book Summary",
              font=("TkTextFont", 11)).grid(row=1, column=2, columnspan=7)
        self._info_text = Text(master=middle_frame,
                               height=10,
                               width=45,
                               font=("TkTextFont", 11),
                               bg='plum2')
        self._info_text.grid(row=2, column=2, columnspan=7)
        self._info_text.tag_configure("bold", font=("TkTextFont", 10, "bold"))

        # RIGHT FRAME WIDGET
        Label(right_frame, text="Book Statistics",
              font=("TkTextFont", 11)).grid(row=1, column=1, columnspan=3)
        self._book_stat = Text(master=right_frame,
                               height=10.5,
                               width=30,
                               font=("TkTextFont", 10),
                               bg='LightSalmon2')
        self._book_stat.grid(row=2, column=1, rowspan=3)
        self._book_stat.tag_configure("bold", font=("TkTextFont", 10, "bold"))

        # Drop Down menu to add a book
        self._add_var = StringVar(left_frame)
        choices = ['eBook', 'Textbook']
        OptionMenu(middle_frame, self._add_var, 'Select Type',
                   *choices).grid(row=3, column=2, pady=5, columnspan=4)

        # Drop Down menu to update a book
        self._update_var = StringVar(left_frame)
        choices = ['eBook', 'Textbook']
        OptionMenu(middle_frame, self._update_var, 'Select Type',
                   *choices).grid(row=3, column=3, pady=5, columnspan=7)

        # A couple buttons - using TTK
        Button(left_frame,
               text="Delete Book",
               width=13,
               command=self._delete_book,
               style='D.TButton').grid(row=3, column=1, pady=5)
        Button(left_frame, text="Quit", width=13,
               command=self._quit_callback).grid(row=4, column=1)
        Button(middle_frame, text="Add Book", width=13,
               command=self._add_book).grid(row=4, column=2, columnspan=4)
        Button(middle_frame,
               text="Update Book",
               width=13,
               command=self._update_book).grid(row=4, column=3, columnspan=7)
        Button(right_frame,
               text="Borrow Book",
               width=13,
               command=self._borrow_cb,
               style='B.TButton').grid(row=5, column=1, pady=5)
        Button(right_frame,
               text="Return Book",
               width=13,
               command=self._return_cb,
               style='R.TButton').grid(row=6, column=1)

        # Now update the list and Statistics
        self._update_book_list()
Exemplo n.º 29
0
    def __init__(self, master, app, **kwargs):
        Frame.__init__(self, master, **kwargs)
        self.columnconfigure(0, weight=1)

        self.app = app

        self.style = Style(self)
        self.style.theme_use("clam")

        self.im_plus = PhotoImage(file=IM_PLUS)
        self.im_moins = PhotoImage(file=IM_MOINS)

        # --- Default category
        self.frame_def_cat = Frame(self)
        self.default_category = StringVar(self.frame_def_cat,
                                          CONFIG.get("General",
                                                     "default_category").capitalize())
        Label(self.frame_def_cat, text=_("Default category ")).grid(row=0, column=0,
                                                                    sticky="e",
                                                                    padx=(4, 0))
        self.categories = CONFIG.options("Categories")
        self.categories.sort()
        categories = [cat.capitalize() for cat in self.categories]
        self.def_cat_menu = OptionMenu(self.frame_def_cat, self.default_category,
                                       CONFIG.get("General",
                                                  "default_category").capitalize(),
                                       *categories)
        optionmenu_patch(self.def_cat_menu, self.default_category)
        self.def_cat_menu.grid(row=0, column=1, sticky="w", padx=4, pady=4)

        # --- Category colors, names ...
        self.frame_cat = Frame(self)
        self.colors = list(COLORS.keys())
        self.colors.sort()
        self.images = []
        for key in self.colors:
            self.images.append(PhotoImage(key, master=self, width=16, height=16))
            fill(self.images[-1], COLORS[key])
        self.cat_colors = {}
        self.cat_labels = {}
        self.cat_menus = {}
        self.cat_buttons = {}
        for i, cat in enumerate(self.categories):
            self.cat_labels[cat] = Label(self.frame_cat,
                                         text="%s" % cat.capitalize(),
                                         anchor='e')
            self.cat_labels[cat].grid(row=i + 2, column=0, sticky="ew", padx=2)
            self.cat_labels[cat].bind('<Double-Button-1>', self.change_name)
            self.cat_colors[cat] = StringVar(self)
            color = CONFIG.get("Categories", cat)
            self.cat_menus[cat] = OptionMenu(self.frame_cat, self.cat_colors[cat],
                                             INV_COLORS[color], *self.colors,
                                             command=lambda color, c=cat: self.change_menubutton_color(color, c),
                                             style="%s.TMenubutton" % cat)
            optionmenu_patch(self.cat_menus[cat], self.cat_colors[cat])
            self.style.configure("%s.TMenubutton" % cat, background=color)
            self.cat_menus[cat].grid(row=i + 2, column=1, sticky="w", padx=4, pady=4)
            self.cat_buttons[cat] = Button(self.frame_cat, image=self.im_moins,
                                           command=lambda c=cat: self.del_cat(c))
            self.cat_buttons[cat].grid(row=i + 2, column=2, padx=4, pady=4)

        self.add_cat_button = Button(self.frame_cat, image=self.im_plus,
                                     command=self.add_cat)
        self.add_cat_button.grid(row=i + 3, column=0, pady=(0, 4))

        if len(self.categories) == 1:
            self.cat_buttons[self.categories[0]].configure(state="disabled")

        # --- placement
        self.frame_def_cat.grid(row=0, column=0, sticky="eswn")
        Separator(self, orient="horizontal").grid(row=1, columnspan=3,
                                                  pady=10, sticky="ew")
        self.frame_cat.grid(row=2, column=0, sticky="eswn")
Exemplo n.º 30
0
    def main_page(self):

        self.label_dimension = Label(
            self.main_tab, text="How many rows and columns do you want ?")
        self.label_dimension.grid(column=0, row=0, sticky='w')
        self.scale_dimension = Scale(self.main_tab,
                                     orient='horizontal',
                                     from_=25,
                                     to=200,
                                     variable=self.dimension,
                                     tickinterval=25,
                                     length=200)
        self.scale_dimension.grid(column=0, row=1, padx=5, pady=5)
        self.frame_dimension = Labelframe(self.main_tab,
                                          text="Order of ideas :",
                                          height=60,
                                          width=300)
        self.frame_dimension.grid(column=0, row=2, sticky='w')
        dimension_frame_label = [
            "<50 this is a bit small", "50<x<150 ideal dimension",
            ">150 quite such huge"
        ]
        for i in range(len(dimension_frame_label)):
            texte = dimension_frame_label[i]
            self.dimension_frame_label = Label(self.frame_dimension,
                                               text=f"{texte}")
            self.dimension_frame_label.grid(column=0, row=i, sticky='w')
        self.dimension_frame_label.grid(column=0, row=2, sticky='w')
        self.label_ant = Label(self.main_tab,
                               text="How many ant(s) do you want ?")
        self.label_ant.grid(column=0, row=3, sticky='w')
        self.scale_ant = Scale(self.main_tab,
                               orient='horizontal',
                               from_=1,
                               to=10,
                               variable=self.nbr_of_ant,
                               tickinterval=2,
                               length=200)
        self.scale_ant.grid(column=0, row=4, padx=5, pady=5)
        self.speed_label = Label(self.main_tab, text="Delay in millisecond :")
        self.speed_label.grid(column=0, row=5, sticky='w')
        self.speed_menu = OptionMenu(self.main_tab, self.speed,
                                     *self.speed_opts)
        self.speed_menu.grid(column=1, row=5, sticky='w')
        self.black_case_label = Label(self.main_tab,
                                      text="Percentage of black cells :")
        self.black_case_label.grid(column=0, row=6, sticky='w')
        self.black_case = Scale(self.main_tab,
                                orient='horizontal',
                                from_=0,
                                to=99,
                                variable=self.black_case_nbr,
                                tickinterval=10,
                                length=200)
        self.black_case.grid(column=0, row=7, padx=5, pady=5)

        self.frame_rules = Labelframe(self.main_tab,
                                      text="Rules setting:",
                                      height=100,
                                      width=400)
        self.frame_rules.grid(column=0, row=8, sticky='w')
        self.label_rules = Label(self.frame_rules,
                                 text="Rules :" + str(self._rules))
        self.label_rules.grid(column=0, row=0, sticky='w', columnspan=3)
        self.button_F = Button(self.frame_rules, text="F", command=self.F)
        self.button_F.grid(column=1, row=1, padx=5, pady=5)
        self.button_L = Button(self.frame_rules, text="L", command=self.L)
        self.button_L.grid(column=0, row=2, padx=5, pady=5)
        self.button_clean = Button(self.frame_rules,
                                   text="Clean",
                                   command=self.clean)
        self.button_clean.grid(column=1, row=2, padx=5, pady=5)
        self.button_R = Button(self.frame_rules, text="R", command=self.R)
        self.button_R.grid(column=2, row=2, padx=5, pady=5)
        self.button_B = Button(self.frame_rules, text="B", command=self.B)
        self.button_B.grid(column=1, row=3, padx=5, pady=5)

        self.chk = Checkbutton(self.main_tab, text='Grid', var=self.chkValue)
        self.chk.grid(column=0, row=9)
        self.chk_two = Checkbutton(self.main_tab,
                                   text='Desctructive collision',
                                   var=self.chkValue_two)
        self.chk_two.grid(column=1, row=9)
        self.button_simulator = Button(self.main_tab,
                                       text="Go to simulation auto",
                                       command=self.simulation_ants)
        self.button_simulator.grid(column=0, row=10)
        self.button_simulator_steps = Button(
            self.main_tab,
            text="Go to simulation step by step",
            command=self.simulation_steps)
        self.button_simulator_steps.grid(column=1, row=10, pady=15)