Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

asking for Help with managing canvas and exporting data to excel file

Hi Everybody!
I have trouble producing a canvas on which a video is shown, and at the same time showing changing numbers (changing following the user's responses 1-5) while exporting the data to the Excel table (row for keypress and row for the thme of each keypress). I would be grateful to get some help. if someone can explain to me how I should implement the idea in the script.
I tried to use the step by step tutorial, but couldn't find out the solution and the deadline is not in my favor.

Thanks
Yuval Levy.
huckkuh.yl@gmail.com

Comments

  • edited March 2018

    Hi Yuval,

    I'm not an expert on video playback, but what you have in mind sounds quite tricky. The problem is that both video and numbers are drawn on the same canvas. Therefore, when you update your canvas to update the number, you would also restart the video, which is of course not what you want. Again, I never really worked with video playback, but maybe it is possible to retrieve the current frame of the video, right before refreshing the canvas, and restart the video from that frame on. Does that make sense? How do you present your video currently?

    while exporting the data to the Excel table (row for keypress and row for the thme of each keypress)

    That is not so difficult. While playing the video you can collect keyboard response and write them to the logfile with something like this:

    kb = Keyboard()
    
    while True:
        var.k,var.t = kb.get_key(timeout = 2)
        if k != None:
            log.write_vars()
    

    This code has to be in an inline_script

    Eduard

    Buy Me A Coffee

  • Hi Eduard!
    Thank you so much for your response.
    I must say that your idea is very creative. It does pose me a new challenge - retrieving frames, but i'll try!
    Thank you for the Excel reference too.

    I will update if your idea worked!

    Yuval

  • edited April 2018

    Hi Guys,
    I saw this thread float by, and because I am working on something very similar, I thought I'd butt in.
    I'm displaying a video using the Media_player_mpy, and I need other visual stimuli to change on screen, similar to what you're going for, Yuval.
    I create a canvas in the custom code window, on which I draw the stimuli that I want, then I call custom python code after every frame, and specify the frame on which I want the change to occur. Retrieving frames is pretty easy this way, using the frame variable, which (as the name implies) contains the current frame.
    one downside of this is that there is a black screen flicker every time the canvas is updated (i.e. every time I use the canvas.show() command to show a canvas with a different constellation of stimuli.

Sign In or Register to comment.