By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
462,167 Members | 682 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 462,167 IT Pros & Developers. It's quick & easy.

Concentric Colored Circles

P: 2
An archery target consists of a central circle of yellow surrounded by concentric rings of red, blue,balck,white.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
Nov 3 '06 #1
Share this Question
Share on Google+
6 Replies

bartonc
Expert 5K+
P: 6,596
An archery target consists of a central circle of yellow surrounded by concentric rings of red, blue,balck,white.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
Nov 3 '06 #2

kudos
Expert 100+
P: 127
Hi, since its friday (and I passed the teoretical driver test), here how you could do it in Tkinter...

Expand|Select|Wrap|Line Numbers
  1. from Tkinter import *
  2.  
  3. root = Tk()
  4.  
  5. # target..
  6.  
  7. fills = ["#ff0000","#00ff00","#0000ff","#00ffff","#ff00ff","#ffff00"]
  8.  
  9. w = Canvas(root, width=300, height=300)
  10.  
  11. x0 = 0
  12. y0 = 0
  13. x1 = 300
  14. y1 = 300
  15.  
  16. for i in fills:
  17.  w.create_oval(x0,y0,x1,y1,fill=i)
  18.  x0+=20
  19.  y0+=20
  20.  x1-=20
  21.  y1-=20
  22.  
  23. w.pack()
  24.  
  25. root.mainloop()
  26.  
-kudos


An archery target consists of a central circle of yellow surrounded by concentric rings of red, blue,balck,white.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
Nov 3 '06 #3

P: 2
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.
Nov 3 '06 #4

bartonc
Expert 5K+
P: 6,596
Hi, since its friday (and I passed the teoretical driver test), here how you could do it in Tkinter...

Expand|Select|Wrap|Line Numbers
  1. from Tkinter import *
  2.  
  3. root = Tk()
  4.  
  5. # target..
  6.  
  7. fills = ["#ff0000","#00ff00","#0000ff","#00ffff","#ff00ff","#ffff00"]
  8.  
  9. w = Canvas(root, width=300, height=300)
  10.  
  11. x0 = 0
  12. y0 = 0
  13. x1 = 300
  14. y1 = 300
  15.  
  16. for i in fills:
  17. w.create_oval(x0,y0,x1,y1,fill=i)
  18. x0+=20
  19. y0+=20
  20. x1-=20
  21. y1-=20
  22.  
  23. w.pack()
  24.  
  25. root.mainloop()
  26.  
-kudos
Thanks, kudos!
Tight code! I don't think that I would have been so succinct.
Keep it up,
Barton
Nov 4 '06 #5

P: 1
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(((getX-200)**2+((getY-200)**2)
so any sugguestions or any help ..

thanks in advance
Nov 6 '07 #6

bartonc
Expert 5K+
P: 6,596
Almost a year, to the day! Kudos gave this wonderful solution (and even made it his avatar) last November.
Nov 7 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.