def option_handler(event):
    """selects action based on the chosen action in OptionMenu widget"""
    global is_running, start_button
    start_button.configure(text="Start")
    is_running = False
    if choice.get() == "random":
        model.seed_random()
    elif choice.get() == "glider":
        model.load_pattern(model.glider_pattern, 10, 10)
    elif choice.get() == "glider_gun":
        model.load_pattern(model.glider_gun_pattern, 10, 10)
    elif choice.get() == "load from file":
        load_file()
    update()
Exemple #2
0
def option_handler(event):
    global is_running, start_button, choice

    is_running = False
    start_button.configure(text='Start')

    selection = choice.get()

    if selection == 'glider':
        model.load_pattern(model.glider_pattern, 10, 10)
    elif selection == 'glider gun':
        model.load_pattern(model.glider_gun_pattern, 10, 10)
    elif selection == 'random':
        model.randomize(model.grid_model, model.width, model.height)
    update()
Exemple #3
0
def option_handler(event):
    global is_running, start_button, choice

    is_running = False
    start_button.configure(text='Start')

    selection = choice.get()

    if selection == 'glider':
        model.load_pattern(model.glider_pattern, 10, 10)
    elif selection == 'glider gun':
        model.load_pattern(model.glider_gun_pattern, 10, 10)
    elif selection == 'random':
        model.randomizar(model.modelo_de_grade, model.largura, model.altura)
    update()
Exemple #4
0
def option_handler(event):
    global is_running, start_button, choice

    is_running = False  #make the simulation stop
    start_button.configure(text='Start')  #then set the button to start

    selection = choice.get()  #assign the chosen option to selection

    if selection == 'glider':
        model.load_pattern(model.glider_pattern, 10, 10)

    elif selection == 'glider gun':
        model.load_pattern(model.glider_gun_pattern, 10, 10)

    elif selection == 'random':
        model.randomize(model.grid_model, model.width, model.height)

    update()