www.delorie.com/gnu/docs/gcl/gcl-tk_3.html   search  
Buy GNU books!

Untitled Document

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.2 Getting Started

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

(in-package "TK")
(button '.hello :text "Hello World" :command '(print "hi"))
(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 section 1.8 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).

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003