Esempio n. 1
0
start = ttk.Button(start_w, text = 'Begin',\
                       command = lambda:[forward(1)])
start.bind("<Button-1>", timeclickStart)
start.pack(side='bottom', pady=(0, 500))

#enter key
submit = Button(
    start_w,
    text="Submit",
    command=lambda:
    [timeclick(),
     appendclick(studid, click=user_emo.get()),
     forward(1)])

em_list = Label(start_w,
                text="HAPPY\n\nSAD\n\nANGRY\n\nSURPRISE\n\nDISGUST\n\nAFRAID",
                background='white')

#quit
button_exit = Button(
    start_w,
    text="Quit",
    command=lambda: [calcData.calcData(),
                     response.organize(),
                     goodbye()])

if __name__ == "__main__":
    windows()

root.mainloop()
Esempio n. 2
0
def forward(img_num):
    global my_pic
    global start
    global submit
    global button_exit
    global studid
    global enter
    global em_list
    start_w.title(' ')

    #similar to windows
    my_pic.pack_forget()
    start.pack_forget()
    submit.pack_forget()
    enter.pack_forget()
    em_list.pack_forget()
    em_list.place_forget()

    enter.delete(0, END)
    submit.configure(state=DISABLED)
    enter.configure(state=DISABLED)

    #trivial statement
    if img_num == 37:
        em_list.pack_forget()
        em_list.place_forget()
        my_pic = Label(start_w, image=imgLAST, bg="white")
        my_pic.pack(side="top", pady=(75, 0))

        button_exit = Button(start_w, text = "Quit", command = lambda:[calcData.calcData(), response.organize(), goodbye(),\
                                                                       collate(image_list_OG), readData()])

        button_exit.pack(side="bottom", pady=(0, 300))

        goodbye_label = ttk.Label(start,
                                  text="Please press quit.",
                                  background="white")
        goodbye_label.pack(side="bottom", pady=(0, 0))

#advancing through imgs
    elif img_num == 1:

        def stream(label):
            video = imageio.get_reader(trial_list[img_num - 1])

            for vid in video.iter_data():
                frame_vid = ImageTk.PhotoImage(Image.fromarray(vid))
                label.config(image=frame_vid)
                label.image = frame_vid

        thread = threading.Thread(target=stream, args=(my_pic, ))
        thread.start()

        my_pic.pack(side="top")

        submit = Button(start_w, text = "Submit", state = DISABLED, command = lambda:[timeclick1(), appendclick(studid, click = user_emo.get()),\
                                                                insert_data(userid, user_emo, img_num + 1),\
                                                                mark_image(img_num - 1, trial_list, user_emo, studid),\
                                                                forward(img_num + 1)])

        em_list = Label(
            start_w,
            text="HAPPY\n\nSAD\n\nANGRY\n\nSURPRISE\n\nDISGUST\n\nAFRAID",
            background='white')

        enter = ttk.Entry(start_w, state=DISABLED, textvariable=user_emo)

        submit.after(5500, entrypack)

    elif img_num % 2 == 0:

        def stream(label):
            video = imageio.get_reader(trial_list[img_num - 1])

            for vid in video.iter_data():
                frame_vid = ImageTk.PhotoImage(Image.fromarray(vid))
                label.config(image=frame_vid)
                label.image = frame_vid

        thread = threading.Thread(target=stream, args=(my_pic, ))
        thread.start()

        my_pic.pack(side="top")

        submit = Button(start_w, text = "Submit", state = DISABLED, command = lambda:[timeclick(), appendclick(studid, click = user_emo.get()),\
                                                                insert_data(userid, user_emo, img_num + 1),\
                                                                mark_image(img_num - 1, trial_list, user_emo, studid),\
                                                                forward(img_num + 1)])

        em_list = Label(
            start_w,
            text="HAPPY\n\nSAD\n\nANGRY\n\nSURPRISE\n\nDISGUST\n\nAFRAID",
            background='white')

        enter = ttk.Entry(start_w, textvariable=user_emo)

        submit.after(5500, entrypack)

    elif img_num != 1 and img_num % 2 != 0 and img_num != 37:

        def stream(label):
            video = imageio.get_reader(trial_list[img_num - 1])

            for vid in video.iter_data():
                frame_vid = ImageTk.PhotoImage(Image.fromarray(vid))
                label.config(image=frame_vid)
                label.image = frame_vid

        thread = threading.Thread(target=stream, args=(my_pic, ))
        thread.start()

        my_pic.pack(side="top")

        submit = Button(start_w, text = "Submit", state = DISABLED, command = lambda:[timeclick1(), appendclick(studid, click = user_emo.get()),\
                                                                insert_data(userid, user_emo, img_num + 1),\
                                                                mark_image(img_num - 1, trial_list, user_emo, studid),\
                                                                forward(img_num + 1)])

        em_list = Label(
            start_w,
            text="HAPPY\n\nSAD\n\nANGRY\n\nSURPRISE\n\nDISGUST\n\nAFRAID",
            background='white')

        enter = ttk.Entry(start_w, textvariable=user_emo)

        submit.after(5500, entrypack)
Esempio n. 3
0
def forward(img_num):
    global my_pic
    global start
    global submit
    global button_exit
    global studid
    global enter
    global trial_list
    global em_list
    start_w.title(' ')
    excel = load_workbook('C:/Users/emily/Desktop/em_recog_static.xlsx')
    data_sheet = excel['DATA']

    #similar to windows
    my_pic.pack_forget()
    start.pack_forget()
    submit.pack_forget()
    enter.pack_forget()
    em_list.pack_forget()
    em_list.place_forget()

    #trivial statement
    if img_num == 61:
        em_list.pack_forget()
        em_list.place_forget()
        my_pic = Label(start_w, image=imgLAST, bg="white")
        my_pic.pack(side="top", pady=(75, 0))

        button_exit = Button(start_w,
                             text="Quit",
                             command=lambda: [
                                 calcData.calcData(),
                                 response.organize(),
                                 goodbye(),
                                 collate(image_list_OG),
                                 readData()
                             ])

        button_exit.pack(side="bottom", pady=(0, 300))

        goodbye_label = ttk.Label(start,
                                  text="Please press quit.",
                                  background="white")
        goodbye_label.pack(side="bottom", pady=(0, 0))

#advancing through imgs
    elif img_num == 1:
        my_pic = Label(start_w, image=trial_list[img_num - 1], bg="white")
        my_pic.pack(side="top", pady=(100, 0))

        submit = Button(start_w, state = NORMAL, text = "Submit", command = lambda:[timeclick1(), appendclick(studid, click = user_emo.get()),\
                                                                 insert_data(excel, data_sheet, user_emo, img_num + 1),\
                                                                 mark_image(img_num - 1, trial_list, user_emo, studid, excel, data_sheet),\
                                                                 forward(img_num + 1), clear()])
        submit.bind("<Button-1>", buttoncall)
        submit.pack(side="bottom", pady=(10, 200))

        enter = ttk.Entry(start_w, textvariable=user_emo)
        enter.bind("<Return>", buttoncall)
        enter.focus_set()
        enter.pack(side='bottom')

        em_list = Label(
            start_w,
            text="HAPPY\n\nSAD\n\nANGRY\n\nSURPRISE\n\nDISGUST\n\nAFRAID",
            background='white')
        em_list.pack()
        em_list.place(x=900, y=500)

    elif img_num % 2 == 0:
        my_pic = Label(start_w, image=trial_list[img_num - 1], bg="white")
        my_pic.pack(side="top", pady=(100, 0))

        submit = Button(start_w, text = "Submit", command = lambda:[timeclick(), appendclick(studid, click = user_emo.get()),\
                                                                 insert_data(excel, data_sheet, user_emo, img_num + 1),\
                                                                 mark_image(img_num - 1, trial_list, user_emo, studid, excel, data_sheet),\
                                                                 forward(img_num + 1), clear()])
        submit.bind("<Button-1>", buttoncall)
        submit.pack(side="bottom", pady=(10, 200))

        enter = ttk.Entry(start_w, textvariable=user_emo)
        enter.bind("<Return>", buttoncall)
        enter.pack(side='bottom')

        em_list = Label(
            start_w,
            text="HAPPY\n\nSAD\n\nANGRY\n\nSURPRISE\n\nDISGUST\n\nAFRAID",
            background='white')
        em_list.pack()
        em_list.place(x=900, y=500)

    elif img_num != 1 and img_num % 2 != 0 and img_num != 61:
        my_pic = Label(start_w, image=trial_list[img_num - 1], bg="white")
        my_pic.pack(side="top", pady=(100, 0))

        submit = Button(start_w, text = "Submit", command = lambda:[timeclick1(), appendclick(studid, click = user_emo.get()),\
                                                                 insert_data(excel, data_sheet, user_emo, img_num + 1),\
                                                                 mark_image(img_num - 1, trial_list, user_emo, studid, excel, data_sheet),\
                                                                 forward(img_num + 1), clear()])
        submit.bind("<Button-1>", buttoncall)
        submit.pack(side="bottom", pady=(10, 200))

        enter = ttk.Entry(start_w, textvariable=user_emo)
        enter.bind("<Return>", buttoncall)
        enter.pack(side='bottom')

        em_list = Label(
            start_w,
            text="HAPPY\n\nSAD\n\nANGRY\n\nSURPRISE\n\nDISGUST\n\nAFRAID",
            background='white')
        em_list.pack()
        em_list.place(x=900, y=500)