Getting Started (GCL TK Manual)

Next: Common Features of Widgets, Previous: Introduction, Up: General [Contents]

### 1.2 Getting Started

Once GCL has been properly installed you should be able to do the following simple example:

    (in-package "TK")
    (tkconnect)
    (button '.hello :text "Hello World" :command '(print "hi"))
    ==>.HELLO
    (pack '.hello)

We first switched to the "TK" package, so that functions like button and pack would be found. After doing the tkconnect, a window should appear on your screen, see See tkconnect. The invocation of the function `button` creates a new function called `.hello` which is a widget function. It is then made visible in the window by using the `pack` function.

You may now click on the little window, and you should see the command executed in your lisp. Thus "hi" should be printed in the lisp window. This will happen whether or not you have a job running in the lisp, that is lisp will be interrupted and your command will run, and then return the control to your program.

The function `button` is called a widget constructor, and the function `.hello` is called a widget. If you have managed to accomplish the above, then GCL is probably installed correctly, and you can graduate to the next section! If you dont like reading but prefer to look at demos and code, then you should look in the demos directory, where you will find a number of examples. A monitor for the garbage collector (mkgcmonitor), a demonstration of canvas widgets (mkitems), a sample listbox with scrolling (mklistbox).