- Table of Contents
- 1. Introduction
- 2. Concepts
-
- 2.1. Percent String
- 2.2. Markup String
- 2.3. Colors
- 3. Commands
-
- 3.1. Non Widget Related Commands
-
- callback -- Manipulate callback functions.
- configure -- Change global gnocl settings.
- clipboard -- Manipulate the clipboard.
- info -- Retrieve different information.
- mainLoop -- Enter the GTK+ event loop.
- update -- Process pending GTK+ events.
- 3.2. Top Level Windows
-
- dialog -- A top level window with standard layout.
- window -- A standard top level window.
- 3.3. Container
-
- box -- A widget which arranges its children horizontal or vertical.
- expander -- A container, which can hide its child widget.
- notebook -- A widget which allows to interactively select which of its children is visible.
- paned -- A widget which allows to interactively resize two children.
- scrolledWindow -- A window which adds scrollbars to its child.
- separator -- A widget which groups widgets horizontal or vertical.
- table -- A widget which arranges its children in rows and columns.
- 3.4. Buttons
-
- button -- A widget which executes a command when clicked.
- checkButton -- A widget which changes between two states when clicked.
- comboBox -- A widget with which one of several alternatives can be chosen.
- radioButton -- A widget from which only one of a group can be selected.
- 3.5. Entries
-
- entry -- A widget which allows the user to input a small amount of text.
- comboEntry -- A widget which allows to input a small amount of text.
- scale -- A slider widget for selecting a value from a range.
- spinButton -- A widget which allows the user to input a number.
- text -- A widget for multi line formatted text editing.
- 3.6. Display widgets
-
- label -- A widget which shows a small amount of text.
- image -- A widget which shows an image.
- progressBar -- A widget which gives the user feedback of background work.
- statusBar -- A widget which reports messages of minor importance to the user.
- 3.7. Menu widgets
-
- menuBar -- A menu container widget.
- menu -- A menu container widget.
- menuItem -- A menu item which executes a command when clicked.
- menuCheckItem -- A menu item which changes between two states when clicked.
- menuRadioItem -- A menu item from which only one of a group can be selected.
- menuSeparator -- A menu item which visually separates different items.
- 3.8. Toolbar widgets
-
- toolBar -- A toolbar container widget.
- toolBar item -- A button like item in a toolbar.
- toolBar checkItem -- A toolbar item which changes between two states when clicked.
- toolBar radioItem -- A toolbar item from which only one of a group can be selected.
- 3.9. Special Selectors
-
- colorButton -- A button to launch a color selection dialog.
- colorSelection -- A standard dialog to choose a color.
- fileChooser -- A standard dialog to choose a file
- fontButton -- A button to launch a font selection dialog.
- fontSelection -- A standard dialog to choose a font.
- 3.10. Tree and List Widgets
-
- tree -- A widget which displays text or other items arranged in a tree.
- list -- A widget which displays text or other items arranged in rows and columns.
- 3.11. Misc. Widgets
-
- eventBox -- A widget which catches events for its child widget.
- plug -- Toplevel to embed into another process
- socket -- Container for embedding windows of other processes
- 3.12. Gnome Canvas Widget
-
- canvas -- A widget which displays graphic objects (in gnoclCanvas).
- canvas bPath -- A canvas item which consists of line and bezier segments. (in gnoclCanvas)
- canvas clipGroup -- A canvas item which implements clipping. (in gnoclCanvas)
- canvas ellipse -- A canvas ellipse item. (in gnoclCanvas)
- canvas image -- A canvas item which shows an image. (in gnoclCanvas)
- canvas line -- A canvas line item. (in gnoclCanvas)
- canvas polygon -- A canvas polygon item. (in gnoclCanvas)
- canvas rectangle -- A canvas rectangle item. (in gnoclCanvas)
- canvas richText -- A canvas rich text item. (in gnoclCanvas)
- canvas text -- A canvas text item. (in gnoclCanvas)
- canvas widget -- A canvas item which shows a normal widget. (in gnoclCanvas)
- 3.13. Gnome Gconf
-
- gconf -- Manipulate the Gnome GConf database.
- 3.14. Gnome VFS
-
- file -- Implement virtual file system commands
- mime -- Retrieve information about files based on their
MIME type.
- 3.15. Gnome
-
- appletFactory -- A command which creates a Gnome panel applet.
- session -- A command which implements an interface to the Gnome session manager.
- 3.16. Deprecated
-
- fileSelection -- A standard dialog to choose a file (DEPRECATED since GTK+ 2.4).
- combo -- A widget that allows the user to input a small amount of text. (DEPRECATED since GTK+ 2.4).
- optionMenu -- A widget with which one of several alternatives can be chosen. (DEPRECATED since GTK+ 2.4)
- A. License Terms
Gnocl implements GTK+ and Gnome bindings for the programming language Tcl
with emphasize on ease of use, following the example of Tk.
It provides commands to build quickly GTK+ / Gnome compliant
applications including the canvas widget, GConf and the Gnome applet.
Gnocl is split in several libraries, which can be loaded on demand.
The newest version of Gnocl can be found at
http://www.dr-baum.net/gnocl/.
Please send feedback, suggestions, bug reports to
<peter@dr-baum.net>
.
The mandatory "Hello World" example looks like this:
#!/bin/sh
# the next line restarts using tclsh \
exec tclsh "$0" "$@"
package require Gnocl
set but [gnocl::button -text "Hello World" -onClicked {puts "Hello World"}]
gnocl::window -title "Hello World Example" -child $but
gnocl::mainLoop

A more complex example which produces a GUI like the following,
is explained in more detail.

package require Gnocl
set menu [gnocl::menu]
$menu add [gnocl::menuItem -text "%#New" -tooltip "Make new" \
-onClicked {puts "That's new"}]
$menu add [gnocl::menuSeparator]
$menu add [gnocl::menuItem -text "%#Quit" -onClicked exit \
-tooltip "Quit program"]
set file [gnocl::menuItem -text "%__File" -submenu $menu]
set menu [gnocl::menu]
$menu add [gnocl::menuItem -text "%__About" \
-tooltip "Show about dialog" \
-onClicked {puts "Mini example (c) 2001 P.G. Baum"}]
set help [gnocl::menuItem -text "%__Help" -submenu $menu]
set toolBar [gnocl::toolBar -style both]
$toolBar add item -text "%#Quit" -tooltip "Tooltip Quit" \
-onClicked exit
$toolBar add space
$toolBar add item -text "%#New" -tooltip "Tooltip new" \
-onClicked {puts "That's new"}
set box [gnocl::box -orientation vertical -borderWidth 0 -spacing 0]
set win [gnocl::window -child $box -title "Test Application"]
$box add [gnocl::menuBar -children [list $file $help]]
$box add $toolBar
$box add [gnocl::label -text \
{%<<span foreground="blue" size="large">Hello</span>\
<span foreground="red" size="large">World</span>}] -expand 1
$box add [gnocl::statusBar]
gnocl::mainLoop