Subject: Re: Canvas (points and markers) - DN [1]


Roger E Critchlow Jr <rec@elf.org> - 05 Aug 1999 - comp.lang.tcl

 "Dionisios Pothos" <dionisios@dpothos.freeserve.co.uk> writes:

 > Does anyone knows a neat way to implement points with different marker
 > shapes in the
 > Canvas ?
 >
 > At the momment the Canvas widget does not provide a point item. But I think
 > it would be a nice
 > feature to have.
 >
 > The solution I have in mind is to implement a point as 2 point lines (line
 > x1 y1 x1 y1) in the canvas background color and implement its marker as
 > another canvas iten centered around it. However, this makes scalling in the
 > canvas a pain since I have to redraw all the markers. This can be ineficient
 > if there are many (thousand such points).
 >
 > If someone has a neat solution please let me know.
 >
 > I think this should be a core feature of the Canvas widget because it is
 > such a foundamental concept in
 > mapping applications.
 >

 Try using bitmaps.  You should be able to find or make a collection of
 16x16 bitmaps with various marker shapes:  point, cross, x, diamond,
 circle, box, and so on.  Create the bitmap object with

     image create bitmap $name -data $data

 then place it in the canvas with

     .canvas create bitmap $x $y -image $name -anchor c

 It will retain it's shape and size under scaling operations.

 -- rec --

Last modified
1999-09-27

(195.108.246.50)

Note: you are looking at
the snapshot of an old wiki
- much of this information
is likely to be very outdated