basegui - combobox - dgw - drawcanvas - hyperhelp - sbuttonbar - seditor - sfilebrowser - sfinddialog - sqlview - statusbar - tablelist - tlistbox - tvmixins

dgw::drawcanvas 0.1

Detlef Groth, Schwielowsee, Germany

2020-04-14

NAME

dgw::drawcanvas - simple drawing tool to sketch some text, lines, rectangles ovals on the fly.

TABLE OF CONTENTS

SYNOPSIS

package require Tk
package require snit
package require dgw::drawcanvas

DESCRIPTION

The widget dgw::drawcanvas provides a simple drawing surface to place, lines, rextangles, ovales and text in different in a fast manner on a canvas. It is based on code in the Tclers Wiki:

COMMAND

dgw::drawcanvas pathName ?-option value ...?

Creates and configures the dgw::drawcanvas widget using the Tk window id pathName and the given options.

WIDGET OPTIONS

As the dgw::drawcanvas is an extension of the standard Tk canvas widget it supports all method and options of this widget. The following option(s) are added by the dgw::drawcanvas widget:

-colors colorList

List of colors which can be used to fill ovals and rectangles. Those colors are a set of pastel like colors.

WIDGET COMMANDS

Each dgw::drawcanvas widget supports all usual methods of the Tk canvas widget and it adds the follwing method(s):

pathName eraseAll ?ask?

Deletes all items in the widget, if ask is true (default), then the user will get a message box to agree on deleting all items.

pathName saveCanvas ?fileName?

Saves the content of the canvas either as ps or if the ghostscript interpreter is available as well as pdf file using the given filename. If the filename is not given the user will be asked for one.

EXAMPLE

In the example below we create a Markdown markup aware text editor.

package require dgw::drawcanvas
dgw::drawcanvas .dc
pack .dc -side top -fill both -expand true

INSTALLATION

Installation is easy you can install and use the dgw::drawcanvas package if you have a working install of:

For installation you copy the complete dgw folder into a path of your auto_path list of Tcl or you append the auto_path list with the parent dir of the dgw directory. Alternatively you can install the package as a Tcl module by creating a file dgw/drawcanvas-0.1.tm in your Tcl module path. The latter in many cases can be achieved by using the --install option of drawcanvas.tcl. Try "tclsh drawcanvas.tcl --install" for this purpose.

DEMO

Example code for this package can be executed by running this file using the following command line:

$ wish drawcanvas.tcl --demo

The example code used for this demo can be seen in the terminal by using the following command line:

$ tclsh drawcanvas.tcl --code

DOCUMENTATION

The script contains embedded the documentation in Markdown format. To extract the documentation you should use the following command line:

$ tclsh drawcanvas.tcl --markdown

This will extract the embedded manual pages in standard Markdown format. You can as well use this markdown output directly to create html pages for the documentation by using the --html flag.

$ tclsh drawcanvas.tcl --html

If the tcllib Markdown package is installed, this will directly create a HTML page drawcanvas.html which contains the formatted documentation.

Github-Markdown can be extracted by using the --man switch:

$ tclsh drawcanvas.tcl --man

The output of this command can be used to feed a Markdown processor for conversion into a html, docx or pdf document. If you have pandoc installed for instance, you could execute the following commands:

tclsh ../drawcanvas.tcl --man > drawcanvas.md
pandoc -i drawcanvas.md -s -o drawcanvas.html
pandoc -i drawcanvas.md -s -o drawcanvas.tex
pdflatex drawcanvas.tex

SEE ALSO

CHANGES

TODO

AUTHORS

The dgw::dgw::drawcanvas widget was written by Detlef Groth, Schwielowsee, Germany.

Copyright

Copyright (c) 2020 Dr. Detlef Groth, E-mail: detlef(at)dgroth(dot)de

LICENSE

dgw::drawcanvas package, version 0.1.

Copyright (c) 2019-2020 Dr. Detlef Groth, E-mail: detlef(at)dgroth(dot)de

This library is free software; you can use, modify, and redistribute it for any purpose, provided that existing copyright notices are retained in all copies and that this notice is included verbatim in any distributions.

This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.