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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Drawing Line between two points on a canvas while dragging the mouse

Status
Not open for further replies.

SmallProgram

Programmer
Feb 6, 2002
42
IN
Hello everybody there,
This a problem Iam facing.I have a canvas and I want to draw a line between two points while dragging the mouse.
What I mean is that when I click the <Button-1> I have to draw a line between the points where I clicked the first button and the point where I have released the Button-1.
Here I used &quot;create Line&quot; but the problem was that I want to show the line between the current point and the point where I have pressed the button-1 first.
It is like drawing a line in any Paint application.
Thank you for all the people who will try to help me.
Iam a starter in TCL/Tk.

SriHariPriya Programmer,Amatuer
 
You might check out the thread thread287-209029, where I posted a code sample that allows you to create and move rectangles on a canvas. I was illustrating one possbility for implementing &quot;gridding&quot; behavior, but it still illustrates the basic principles of canvas programming.

I tell people in my classes that all canvas programming comes down to &quot;Click-Drag-Release.&quot; Almost all canvas-based programs need bindings for Click (<ButtonPress-X>), Drag (<BX-Motion>), and release (<ButtonRelease-X>) events. it's what you do in those bindings that's application-dependent. - Ken Jones, President
Avia Training and Consulting
866-TCL-HELP (866-825-4357) US Toll free
415-643-8692 Voice
415-643-8697 Fax
 
Thank You Mr.Ken Jones
I had my problem solved with it
Programmer,Amatuer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top