Concentric Colored Circles

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • funke
    New Member
    • Nov 2006
    • 2

    Concentric Colored Circles

    An archery target consists of a central circle of yellow surrounded by concentric rings of red, blue,balck,whit e.Each ring has the same width which is the same aas the radius of the yellow circle.Write a program that draws such a target.

    I'm not getting it at all.I need help pleaseeeeeeeeee
  • bartonc
    Recognized Expert Expert
    • Sep 2006
    • 6478

    #2
    Originally posted by funke
    An archery target consists of a central circle of yellow surrounded by concentric rings of red, blue,balck,whit e.Each ring has the same width which is the same aas the radius of the yellow circle.Write a program that draws such a target.

    I'm not getting it at all.I need help pleaseeeeeeeeee
    What point are you up to? Can you do any graphics? What tools are you using? Tkinter, etc.? Is it just the math that you are hung up on? Tell us more. We're here to help you get started,
    Barton

    Comment

    • kudos
      Recognized Expert New Member
      • Jul 2006
      • 127

      #3
      Hi, since its friday (and I passed the teoretical driver test), here how you could do it in Tkinter...

      Code:
      from Tkinter import *
      
      root = Tk()
      
      # target..
      
      fills = ["#ff0000","#00ff00","#0000ff","#00ffff","#ff00ff","#ffff00"]
      
      w = Canvas(root, width=300, height=300)
      
      x0 = 0
      y0 = 0
      x1 = 300
      y1 = 300
      
      for i in fills:
       w.create_oval(x0,y0,x1,y1,fill=i)
       x0+=20
       y0+=20
       x1-=20
       y1-=20
       
      w.pack()
      
      root.mainloop()
      -kudos


      Originally posted by funke
      An archery target consists of a central circle of yellow surrounded by concentric rings of red, blue,balck,whit e.Each ring has the same width which is the same aas the radius of the yellow circle.Write a program that draws such a target.

      I'm not getting it at all.I need help pleaseeeeeeeeee

      Comment

      • funke
        New Member
        • Nov 2006
        • 2

        #4
        Originally posted by bartonc
        What point are you up to? Can you do any graphics? What tools are you using? Tkinter, etc.? Is it just the math that you are hung up on? Tell us more. We're here to help you get started,
        Barton

        i'm using graphics.I have to make concentric circles in which the next circle will be drawn on the next circle.

        Comment

        • bartonc
          Recognized Expert Expert
          • Sep 2006
          • 6478

          #5
          Originally posted by kudos
          Hi, since its friday (and I passed the teoretical driver test), here how you could do it in Tkinter...

          Code:
          from Tkinter import *
           
          root = Tk()
           
          # target..
           
          fills = ["#ff0000","#00ff00","#0000ff","#00ffff","#ff00ff","#ffff00"]
           
          w = Canvas(root, width=300, height=300)
           
          x0 = 0
          y0 = 0
          x1 = 300
          y1 = 300
           
          for i in fills:
          w.create_oval(x0,y0,x1,y1,fill=i)
          x0+=20
          y0+=20
          x1-=20
          y1-=20
           
          w.pack()
           
          root.mainloop()
          -kudos
          Thanks, kudos!
          Tight code! I don't think that I would have been so succinct.
          Keep it up,
          Barton

          Comment

          • teddybunny
            New Member
            • Nov 2007
            • 1

            #6
            concentric colored circles

            whats up guys .. i just have a Question.. i am working on a concetric circles or u can say a circle andd surrounded by 4 rings .. i wanna make them all color by clicking on them .. when i click on one of the rings or the circle .. it changes its color randomly .. i am done with drawing the circles and i came up with a mathimatical formula for my work .. r=math.sqrt(((g etX-200)**2+((getY-200)**2)
            so any sugguestions or any help ..

            thanks in advance

            Comment

            • bartonc
              Recognized Expert Expert
              • Sep 2006
              • 6478

              #7
              Almost a year, to the day! Kudos gave this wonderful solution (and even made it his avatar) last November.
              Last edited by bartonc; Nov 7 '07, 04:10 PM.

              Comment

              Working...