So I am trying to simulate a mouse clicks. The goal is to do it based on an EMG/EEG, but im trying to build a better understanding of pyschopy first. Right now Im trying to make the program treat a key press (q,w, and e) the same as a left, middle, or right middle click. My first idea was to set booleans that turn true if q (left), w (middle), or e (right) were pressed. However, as expected this doesnt actually work as intended.
In this line of code:
if mouse.isPressedIn(circle, buttons=[0]) or leftClick == True:
circle.fillColor = ‘blue’
elif leftClick == True or mouse.isPressedIn(square, buttons=[1]):
circle.fillColor = ‘green’
elif mouse.isPressedIn(circle, buttons=[2]) or rightClick == True:
circle.fillColor = ‘red’
It doesnt work for the middle click. If I overlap the square and circle, and middle click, the circle turns green. But if I press ‘w’, nothing occurs. Im not sure if I explained well, but basically, I want the program to react as if/think that the mouse was clicked, if I press specific keys (and in the future, if it recieves a certain signal)
Hi chen, thank you! That was the issue. I guess trying to learn how to use psychopy and study for my finals at 3am was a bad idea lol.
I was wondering, do you know how I could do this with emg data instead of threading? I have a function that will take data from an emg, into 3 buffers(buffer_x, buffer_y, and buffer_z). Based on x and y it should move the object. so if the buffer x is negative, it should move left, and if positive it move right (and buffer y would be up/down). Do you have any advice for how i could accomplish this?