Howdy, Stranger!

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

Supported by

Creating multicolored circle

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

    Thanked by 1zgolot
  • Thank you very much, that was very helpful.

    Best,

    Zgolot.

  • edited March 20

    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.

  • edited 12:34PM

    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

Sign In or Register to comment.