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!

Solutions for canvas

Status
Not open for further replies.

Bussotao

Programmer
Mar 26, 2002
11
BR
I have just started with tcl/tk and I've been trying to develop a simple routine to plot xy points in a file created by a c++ program. I created a list of entry widgets
that pass the pararameters for the c++ program. This one saves the list of xy points in a file and and the points are read and plotted in the canvas (using the command line). It is already working but only once. It means that if I change the parameters the routine runs the c program, reads the new file but the canvas is not refreshed. Is there any command to do that? I'm open to other solutions also. Thanks.


 
It depends on how you draw your objects on the canvas. By brute force, you could destroy and re-create the canvas each time you read the list of points. If you want to have the old plot and the new plot at the same time, you need to reset your starting position (I'm sure you know that already). Maybe there is some parameter (old x, old y) that is being used that you neglected to reset (to, say, first x and first y) when you read the new list? Bob Rashkin
rrashkin@csc.com
 
It is quite difficult to debug your problem without further information, and I'm not quite sure which thread to pull on to see where things unravel.

So instead, I'm going to take an entirely different path by saying that if your actual goal is to display a scatter plot of data points, forget the canvas widget. Instead, get the BLT extension, which has a wonderful, extremely full-featured graph widget. I don't know if it will solve the particular problem you're describing here, but even if it doesn't, you'll find life much better using BLT's graph widget rather than trying to implement your own graphing on a canvas.

You can pick up BLT from SourceForge, at For some good "getting started" guidance, make sure you download George Howlett's presentation on BLT. They're PDF files available in the download area. So from the BLT home page, click "View ALL Project Files", then download either handouts.pdf or slides.pdf (I forget which one). - Ken Jones, President
Avia Training and Consulting
866-TCL-HELP (866-825-4357) US Toll free
415-643-8692 Voice
415-643-8697 Fax
 
Thanks, Bong, I forgot reseting some graphical variables.
I'll have a look in BLT also.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top