#!/bin/sh
# the next line restarts using tclsh \
exec tclsh "$0" "$@"

load ../src/gnocl.so

set canvas [gnocl::canvas -antialiased 1 -width 500 -height 500 \
       -scrollRegion {0 0 500 500} -scrollbar never]

# anchor
set x 100
set y 150
$canvas create text [list $x $y] -label "anchor does not seem to work." \
      -fill red -anchor W
puts "nach text"
incr y 20
foreach el {center N NW NE S SW SE W E} {
   $canvas create widget [list $x $y] \
         [gnocl::button -text "anchor $el" -command "puts \"anchor $el\""] \
         -anchor $el
   $canvas create ellipse [list $x $y 2] -centerRadius 1 -fill red
   incr y 30
}

if { $argc == 1 } {
   set win [gnocl::plug [lindex $argv 0] -child $canvas]
} else {
   set win [gnocl::window -child $canvas]
}

gnocl::mainLoop

