Skip to content

Instantly share code, notes, and snippets.

/*
* hello.c -- A minimal Tcl C extension.
*/
#include <tcl.h>
static int
Hello_Cmd(ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
Tcl_SetObjResult(interp, Tcl_NewStringObj("Hello, World!", -1));
return TCL_OK;
@paulwal
paulwal / odict.tcl
Created August 1, 2016 16:54
Tcl OO dict
oo::class create odict {
variable Dict
constructor {dict} {set Dict $dict}
forward exists my Val exists
forward filter my Val filter
forward get my Val get
forward info my Val info
forward keys my Val keys
forward merge my Val merge
forward remove my Val remove
@paulwal
paulwal / canvas_animate.tcl
Last active August 29, 2015 14:05
Extend the Tk canvas to enable animations
# canvas_animate.tcl
# Animate canvas items.
#
# Usage:
# <canvas> animate <tagOrId> ?-xamount <pixels>? ?-yamount <pixels>? ?-duration <milliseconds>? ?-easing <function name>? ?-command <command>?
# <canvas> easings
# -> <list of easing function names>
# Rename the original 'canvas' command and redefine it to create a new object in this class.
# The object name will be identical to the path of the canvas, and the canvas command will