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


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?




  • 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.



  • Thank you very much, that was very helpful.



  • edited March 2019

    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,



  • edited March 2019

    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:

    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.



  • 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.


    Buy Me A Coffee

  • edited May 1

    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!

    from math import sin, cos
    def arc_xy(start_angle, end_angle, radius = 100, width = 10, x = 0, y = 0):
      innerEdge = []
      outerEdge = []
      # Simple fix, if start angle > end angle, then reverse the two!
      if start_angle > end_angle:
        start_angle, end_angle = end_angle, start_angle 
      for angle in range(start_angle,end_angle + 1):
       # Rotating, so that everything starts from the bottom
         angle += 180
       # Preparing inner edge 
         cx = int(round((radius - width) * sin(angle * 0.0174532925),0))
         cy = int(round((radius - width) * -cos(angle * 0.0174532925),0)) 
         innerEdge.append([x + cx,y + cy])
       # Preparing outer edge
         cx = int(round((radius + width) * sin((start_angle + end_angle - angle) * 0.0174532925),0))
         cy = int(round((radius + width) * -cos((start_angle + end_angle - angle) * 0.0174532925),0)) 
         outerEdge.append([x + cx,y + cy])
      allEdge = innerEdge + outerEdge
      return allEdge
    c = Canvas()
    c.polygon(arc_xy(start_angle = 340, end_angle = 60, x = 15), color = (80,80,80), fill = True)

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games