![]() ![]() I now can switch color of the button back and forth. If clicked_button.fillColor = 0.0039:Įlif clicked_button.fillColor = 1.0000: use PsychoPy RGB code preceded by dollar sign (e.g., $) instead of color name (e.g., gray) to set the property of “Fill Color” under the tab of “Appearance” for the clickable object.I solved it like this (in my example, I need the gray button to turn to coral when clicked, then turn back to gray when clicked again, and switch between the two colors): I really don’t know what’s going on anymore. When they do, they remain perfectly visible and stable and even disappear at the next click. It now behaves even weirder, in that the items appear sporadically at click, only a small number of times, if I keep clicking throughout the routine. If mouse.isPressedIn(clicked_bar) and clicked is True: If mouse.isPressedIn(clicked_bar) and clicked is False: I tried phrasing it differently to work around possible issues with color definition and changing to None instead of ‘none’.īegin routine: bars = I tried using is as comparison method instead of = still doesn’t work. In other words, each image should cycle between appearing and disappearing at following clicks. However, I would like the subject to be able to change his mind and “turn off” any item by clicking on it again (reversing to none color, thus disappearing, which I cannot make happen). ![]() Once the trial is played the participant can respond by clicking the mouse in one of the ‘four images’ on screen. At first click the item should appear, turning to white (which happens perfectly well). The first one is inserted to just show a picture (actually a ‘play button’ ) until a mouse is clicked on it.Once the mouse is clicked on it the next routine, i.e., the ‘actual trial’ gets to run. They all start on background ( none) color, therefore invisible to the subject. Also, I always get the following warning after closing the task:įutureWarning: elementwise comparison failed returning scalar instead, but in the future will perform elementwise comparisonīegin routine bars = The bars appear (turn from none to white) but never switch back to none (disappear) upon following clicks. What specifically went wrong when you tried that?: I have tried setting the initial color to $‘none’ or leaving it unspecified (it doesn’t seem to have any effect). I have set the appearance parameters such as Foreground Color of the image to constant in order to not interfere with the coded commands. I tried working with polygons rather than an image, and it still doesn’t work. I tried to adapt every single solution reported in those cases: none of them works for me. They are all pretty similar and similarly solved. I am aware that there are multiple previous instances of the same request here on the forum. I could easily code the initial transition from none to white color (the bar appearing) I cannot make the switch-back transition happen, from white to none color (the bar disappearing). All the bars are actually based on a single png image of a white bar used repeatedly. becoming visible, changing from background none colour to white) and disappear (from white to none color), as many times as the subject wants. The task needs a number of bars to appear on click (i.e. PsychoPy version : Standalone PsychoPy 2021.1.4 for 64bit Windows (using Python3.6) ![]()
0 Comments
Leave a Reply. |