Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Urgent Pls...Drawing a circle

Status
Not open for further replies.

kokoko12000

Programmer
Apr 14, 2003
13
0
0
US
Hi all,
I am new to Tcl/tk. I have problem to solve. I will attach the problem below. I am really not asking the solution for the problem, but I wanted to know from where to start solving the problem. I have a due in four days. So right now I cannot go through all the tutorial stuff to solve it. SO could anyone please suggest me what are the required topics/lessons should I go through to solve this particular problem.

Problem:
Design a program capable of digitizing circles. The system should start with a single window containing a grid of 20x20 points.

All points should start out grey. The user can then click to place the center of a circle, and then drag to set it's radius, similar to various graphics programs. The circle should be drawn on the screen.

When the user releases the mouse button, the program should highlight the points (make them blue) that correspond to the edge of the circle, in a way such that the points could be connected to reconstruct the circle.

Then, two additional circles should be created corresponding to the largest and smallest radius of the highlighted points.


Thank you.

Any suggestions are highyl appreciated.
 
I would use the bindings: <B1-ButtonPress> and <B1-ButtonRelease> with the event fields, %x and %y for each to mark the radius. Then draw (create) the circle at origin, %x,%y from ButtonPress. I think there are some more exotic widgets that resize but I don't know how to use them.

Look in the help file under Tk Manual/Tk Built-in Commands/Events and bindings/Bind.

Good luck.

Bob Rashkin
rrashkin@csc.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top