thartbm / PyVMEC

A Python-based GUI to create and run visuo-motor experiments.
GNU General Public License v3.0
1 stars 3 forks source link

press space starts new experiment #56

Closed thartbm closed 6 years ago

thartbm commented 6 years ago

When pressing SPACE for the Xth time to end a pause trial, the last GUI button that was clicked gets activated. That is the button that starts a new experiment so you get a pop-up asking for a new participant ID, and there seems to be no way to get back to the actual experiment.

Marco ran himself on an experiment twice and each time at the same point he got this issue. That means we just can't run the experiments we want to run....

Possible solutions are changing the button (to C for 'continue'... or G for 'GO'?), or messing with the focussed window by telling PsychoPy to put focus on itself. Alternatively, all buttons in the PyVMEC GUI should be 'inactive' as long as an experiment runs...

thartbm commented 6 years ago

There is a function psychopy.visual.Window._setCurrent() that might do the trick. I see mentions of an activate() method of psychopy windows, but I can't find it.

thartbm commented 6 years ago

Yeah, I don't think it's related to pressing the space bar, but rather that the psychopy window loses focus when you lift the pen. Or rather when you put it back down, as that counts as a mouse click...

Of course, this would only happen on out tablet setup.

juliusjgm12 commented 6 years ago

I see,

I've added a module called pyautogui to the experiment.py that moves the mouse to a different location at the start of an experiment. Hopefully this will prevent any clicking issues from occurring. It is strange because on my set-up, the PyVMEC GUI is locked while a PsychoPy visual window is open.

This might just be a quick fix for now but we can test it out so that it'll at least allow for experiments to be run without errors?

I also disabled the run button while experiments run so it can't possibly disrupt a running experiment.

thartbm commented 6 years ago

I'm not sure if moving the mouse to a different location would solve it. Can we force focus on the PsychoPy window?