Wednesday, October 06, 2010

gnocl::stockItem -finished!

In the end I decide against the creation of new stock items from pre-existing items. So, here's what a piece of test script and its screenshot looks like






#---------------
# test-stockitems.tcl
#---------------
# Created by William J Giddings
# 06-Oct-2010
#---------------

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

package require Gnocl
 

#----- create stock item from an existing buffer -----#
 set pb1 [gnocl::pixBuf load -file [pwd]/georgie.jpg]

gnocl::stockItem add \
    -label Georgie \
    -icon "%?$pb1"


#----- create stock item from disk objects  -----#
gnocl::stockItem add \
    -label News \
    -icon "%/[pwd]/news.png"

gnocl::stockItem add \
    -label White \
    -icon "%/[pwd]/night1.png"

gnocl::stockItem add \
    -label Black \
    -icon "%/[pwd]/night2.png"


 #----- display the whole lot  -----#
set box [gnocl::box]
set but1 [gnocl::button -icon "%#News" -text News]
set but2 [gnocl::button -icon "%#White" -text White]
set but3 [gnocl::button -icon "%#Black" -text Black]
set but4 [gnocl::button -icon "%#Georgie" -text Black]
$box add [list  $but1 $but2 $but3 $but4 ]
gnocl::window -child $box
gnocl::mainLoop

No comments: