Tcl/Tk GUIs consist largely of components such as buttons, labels entry boxes and sliders. Sometimes you'll need something that's much more graphic and for this you'll use a canvas widget. You can write to a canvas down to individual pixel level, and you can also draw lines, ovals, rectangles, text and polygons. This module studies the options for drawing to and manipulating a canvas, and introduces computer graphic techniques such as world to pixel co-ordinate transformations and display list manipulation.
This topic is presented on public course
Tcl/Tk
Examples from our training material
| can1 | drawing on a canvas |
| can2 | Drawing shapes on a canvas and dragging them with the mouse |
| can3 | demo of different graphic objects |
| can4 | Line styles on a Tk canvas |
| histo | Histogram drawn on a canvas - generalised code |
| imgoncanvas.tk | Placing a GIF on a canvas |
| tktext | text options in Tk - colour, font, size, centering |
Opentalk forum discussions related to this topic
how to use scrollbars for canvasbinding rectangles in tk canvasMoving object
Pictures
Using a Tcl/Tk canvas
Background information
Some modules are
available for download as a sample of our material or under an
Open Training Notes License for free download from
http://www.training-notes.co.uk.
Topics covered in this module
Canvas basics; coordinate system, colour, etc.
Canvas objects. Rect, text, line, etc.
Attributes of canvas objects.
The display list, tagging and manipulating objects.
Tips and techniques for graphics programming.
Complete learning
If you are looking for a complete course and not just a information on a single subject, visit our
Listing and schedule page.
Well House Consultants specialise in training courses in
Tcl/Tk, Expect,
Python,
Perl,
PHP, and
MySQL. We run
Private Courses throughout the UK (and beyond for longer courses), and
Public Courses at our training centre in Melksham, Wiltshire, England.
It's surprisingly cost effective to come on our public courses -
even if
you live in a different
country or continent to us.
We have a technical library of over 600 books on the subjects on which we teach.
These books are available for reference at our training centre. Also
available is the Opentalk
Forum for discussion of technical questions.