Canvas item class

Grant Edwards grante at visi.com
Wed Jan 10 14:44:00 EST 2001


In article <3A5C3CF4.2C5B6032 at et.dtu.dk>, Brian Elmegaard wrote:

>I am trying to (find out how to) make an application for making
>flowsheets of energy plants and exporting the relevant data to
>simulators. I primarily consider tk(inter)for the GUI.
>
>The flowsheet will consist of schematic drawings of different devices.
>These may need to be made out of more than one canvas item. Furthermore,
>the components should also keep tracks of different parameters for the
>device.
>
>So, what I would like to have is a component class inheriting the
>methods of a generic canvas item and be able to configure this to my
>needs and then draw them as wanted. However, reading 'An introduction to
>tkinter' it seems to me that canvas items are not like other tkinter
>objects, so I am not sure that it can be done this way. Am I off-track? 

Canvas items (e.g. lines, curves, text-strings, etc.) are not
objects (in the Python sense).  They are part of the internal
state of the canvas object.  You can use "tags" to group canvas
items into "pseudo-objects" that can then be manipulated using
the canvas methods.

As part of my masters project I wrote a ladder-diagram editor
in Scheme using the Tk canvas. I suspect you will need to to
similar things: there are various types of compound objects,
each of which has one or more paramters.  The user places the
objects on the canvas, edits the parameters, and connectes them
together with "wires".

If you'd like to see how this is done, there are links down at
the bottom of my web page: www.visi.com/~grante

Some day I'll translate the diagram editor from Scheme to
Python...

-- 
Grant Edwards                   grante             Yow!  Are you still
                                  at               SEXUALLY ACTIVE? Did you
                               visi.com            BRING th' REINFORCEMENTS?



More information about the Python-list mailing list