TkTurtle v1.0 This is a simple Logo-like turtle graphics package implemented in Extended Tcl. It does not include any programming environment support, everything must be done from the command line or sourced files as in normal Tcl programming. It needs Extended Tcl, mainly for the trig functions. It's been a long time since I've used Logo, so the style here may be closer to the Smalltalk-80 Pen class, or the Lightspeed Pascal turtle graphics libraries (which I used as references) than real Logo. TkTurtle works by making a canvas, and then defining Tcl procedures to display a turtle, and draw patterns. No C code is included in this package (but, of course, it currently needs Extended Tcl). There is a fair range of turtle commands supported, with the exception of real colour: the colour command currently uses stipple patterns. The use of English, rather than American spellings (colour, centre) may be considered a bug by some. This has actually been used in anger, as part of a short course to interest high school students in computer science. It seems fairly stable, but, of course, this is not warranted for anything :-) The distribution consists of one file of code (turtle), a file of examples, and this short readme. There is no real documentation. You are welcome to use this as you see fit, providing the usual credit is given to the original author. COMMANDS turtle initialise the turtle library. This is the command that should be autoloaded, the other commands being loaded in the file as the package is invoked go move the turtle pixels - a line will be draw if the pen is down go 20 goto move the turtle to the position specified - a line will be draw if the pen is down goto 0 0 write prints the as a string at the current position write "Hello John" up put the pen up - the turtle will move without drawing up down put the pen down - the turtle will now draw lines down turn turns the turtle degrees clockwise - if is negative, counterclockwise turn 90 north set the turtle's direction to north (270 degrees) north turnto sets the turtle's direction to be turnto 175 width [] with one argument (must be an integer) sets the width of lines the turtle will draw with no arguments, returns the current width width 3 colour [] with one argument (must be an integer) sets the pattern of lines the turtle will draw with no arguments, returns the current width colour 4 show draws the turtle show hide hides the turtle - the turtle will still leave a trace if it is down, but won't itself be displayed - makes things run faster. hide home move the turtle to the center and point it north clear clear the screen, home the turtle, and reset colour and width information screen-dump write a screen dump - with no arguments, to Screen-dump.ps - with one argument, to that filename EXTRA COMMANDS move same as go, goto, except the don't draw, and moveto don't change the turtle state. south shortcuts for turnto 90, etc. east west d2r converts degress to radians for calling the trig functions direction returns the turtle's direction location returns a two-element list, the turtle's location slow sets slow mode fast sets fast mode speed [] like a ZX-81, fast mode doesn't update the screen after every movement. pen [] with no arguments, returns the pen status with one argumenr of 0 or 1, sets the pen status centre centre the screen, not the turtle (use home to centre the turtle) status [] with no arguments, returns a six-element list containing turtle status with one argument of such a list, set status set saved [status] # save status status $saved # restore window place a window onto the canvas at the current position new clear, and also remove any windows SHORTCUTS IN THE TURTLE WINDOW Button-2 drag-scroll the window C centre the window F toggle speed (slow mode/ fast mode) T toggle command tracing S toggle turtle display (hide/show) C-C, C-Q quit TO DO LIST * Vanilla Tcl version of TkTurtle * Programming environment (steal from wtour?) * Extension to multiple turtles and canvasses * Real colour support * Reorganise so it runs **faster** * Don't add a new line item for each drawn segment - collect line squences into large line items * fix it so everything worked in degrees (no need for d2r) Suggestion, comments, etc, are always apprecitated James Noble kjx@comp.vuw.ac.nz