Creating multicolored circle
in OpenSesame
Hello,
I am trying to create a circle with 360 colors (one per °) with OpenSesame (backend psychopy) but I don't really know how to proceed. One of my thought was to draw 360 smalls lines in a circular shape, but it seems tedious and would be rather slow.
Would you have any advice for drawing this circle?
Best,
Zgolot.

Comments
Hello Zgolot,
This is an in-line script that does most of the job. You will have to adapt the colors according to your need and keep in mind that each of the 3 RGB parameters must be in the range 0-255.
Best,
Gérard
Thank you very much, that was very helpful.
Best,
Zgolot.
Hello again, I managed to create the circle I wanted but now I've got another issue. So on this screenshot, you can see what I managed to do. For the task, the filled bar changes color in real time according to mouse angle from the center. So when the mouse is on the circle it's fine but when it's not, the filled bar still changes color and I'd like to avoid that and make it so it only changes color when mouse hovers the circle. My problem is that I don't know how to determine whether the mouse is on the circle or not.
Thanks for your help,
Best,
Zgolot.
I have found a solution to my above problem. I named each line of the color circle by its color (so each line is called "rgb(xx.xx%,xx.xx%,xx.xx%"). And then I used this small code to check whether the mouse is on an element that has "rgb" in it:
check=self.c.elements_at(x,y) if any("rgb" in ch for ch in check): """ change color and do stuff"""I guess there is a better and cleaner way to do that, but so far I haven't encountered any bug.
Best,
Zgolot
Hi zgolot,
that looks great! I am currently trying to implement something related: I want to draw part of a circle, i.e. a circular line with a start and end point. So far I managed to just occlude part of the circle which I don't want to show, but this workaround has its limits. Could you maybe share your solution for the multicolored circle above?
Hi Tcar,
If I understand right, you could do 2 things:
1) Use the background color for the part of the circle that you want to omit, so that it won't be visible.
2) Break the loop once you have drawn the part of the circle that you want to see.
Either one is fine.
Eduard
Hi eduard,
I found a solution to my problem by creating a polygon with many edges which follow the outline of a partial circle. See code for this below.
Have a nice weekend!