def main():
    if check_files():
        window = init_gui()
        # Show the window
        window.mainloop()
    else:
        return
示例#2
0
def main():

    win = gui.init_gui()
    gpio, kit = init_hardware()
    quadrants = loading.load_pills(win, gpio, kit)
    #     external.sendemail("*****@*****.**", "Tylenol")
    while True:
        schedule.run_pending()
        gui.change_instruction_text(
            win,
            "Next pill will be dispensed at {}".format(schedule.next_run()))
        gui.change_button_text(win, ["Dispense", "", ""])
        interface.pressed_red_button(gpio, win, quadrants[0], 1, kit)
        # need to run this every loop iteration
        gui.maintain_gui(win)
示例#3
0
check_config_valid()
states = list(range(q))
rg = RandomState(RANDOM_SEED)

field = generate_field(states, WIDTH, rg, correlation=0.3)
figure = plot_field(field, states)
energy = calculate_energy_of_field(field, INTERACTION, interaction_coefficient=J, magnetization_coefficient=h)
free_energy = 0
mc_step = 0


def update_step() -> None:
    global mc_step, field, free_energy, figure
    field, free_energy = update_metropolis(field, states, free_energy, INTERACTION, interaction_coefficient=J,
                                           magnetization_coefficient=h, random_state=rg, temperature=TEMPERATURE)
    mc_step += 1
    if mc_step % PLOT_EVERY_X_STEPS == 0:
        figure = plot_field(field, states)
        draw_figure(canvas, figure)
        update_energy_label(label, mc_step, free_energy)


root = tkinter.Tk()
label, canvas = init_gui(root, figure, update_step)

tkinter.mainloop()




示例#4
0
文件: sniffer.py 项目: furrtek/LGV3
def on_button_joueur():
    i = len(glb.joueurs)
    add_joueur(i, "joueur" + chr(i + ord('A')), 1, randint(0, 30),
               randint(0, 30), randint(50000, 65535))
    gui.update_joueurs()
    gui.update_equipes()


# Temps restant
# Statut partie
# Table equipes:
#   NOM | NB JOUEURS | SCORE
# Table joueurs:
#   PSEUDO | EQUIPE | Recu | VBat

if __name__ == '__main__':
    # Debug
    time_elapsed = 456
    time_max = 1200

    glb.init()

    gui.init_gui()

    update_time()

    glb.window.show()

    glb.app.exec_()
示例#5
0
from flask import Flask
from gui import init_gui

app = Flask(__name__)
# Reduces Cache Time for Static Files
app.config["SEND_FILE_MAX_AGE_DEFAULT"] = 0
from routes import *

if __name__ == '__main__':
    init_gui(app)
示例#6
0
                matrix.append(arr)
            f.close()
        else:
            print("Input Name " + input_path + " is directory. Exiting ...")
            return False
    else:
        print("Input File " + input_path + " does not exsit. Exiting ...")
        return False
    return True


input_array_matrix = []
if not read_input(sc.input_path):
    exit(1)
#  Initialization : Drawing UI, seting up threads
screen = gui.init_gui()
done = False
engine_run = False
index_matrix = 0

#  matrix_to_show is a shared recource between threads
matrix_to_show = input_array_matrix[index_matrix]
#  print(len(input_array_matrix))

while not done and index_matrix < len(input_array_matrix):
    if not engine_run:
        engine.print_sudoku(input_array_matrix[index_matrix])
        t = Thread(target=engine.main_method,
                   args=(
                       input_array_matrix[index_matrix],
                       0,
示例#7
0
def main():
    config = settings.config
    storage = NodeStorage(create_new_session(config))
    init_gui(storage)