[ltk-user] Beginners question

Ken Tilton kentilton at gmail.com
Fri Oct 27 21:07:06 UTC 2006

On 27 Oct 2006 22:58:14 +0200, Nicolas Neuss <neuss at math.uka.de> wrote:
> Hello LTK users,
> As a complete GUI programming newbie I wanted to try LTK, but immediately
> have several questions:
> 1. Are there any example programs using LTK?

Last I looked, there was a substantial little demo at the end of the source
file. may have been called ltktest. That even has something pretty close to
what you are trying to do (and a lot more).

2. I don't know anything about Tk, unfortunately.  Is there some tutorial
>    to GUI programming with Tk?

Just go to the Tcl/Tk site and you'll find quite a lot of info.

3. My current goal is to have a small window which displays a new random
>    number whenever I press a button.  I thought about using
>    message/textvariable in the following code snippet:
> (defun zufallszahl ()
>   (with-ltk ()
>     (let* ((x "0")
>        (f (make-instance 'frame))
>        (text (make-instance 'message :text x :width 100))
>        (button (make-instance 'button
>                   :master f
>                   :text "Next"
>                   :command (lambda ()
>                      (setq x (format nil "~D" (random 10)))))))
>       (pack f)
>       (pack text :side :top)
>       (pack button :side :bottom)
>       (configure f :borderwidth 3)
>       (configure f :relief :sunken)
>       )))
> Unfortunately, (make-instance 'message :textvariable x :width 100) does
> not
> work.  Is this a bug?
> 4. How can I put the message above the button?  I tried several
>    combinations of :side XXX, none did achieve it.
> 5. How can I change the text of the message into something larger?
> Thank you very much for any hints,

I think I see quite a few problems (and my LTk is rusty) so I will defer to
others. In the meantime you might start over with ltktest.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ltk-user/attachments/20061027/a38f67b2/attachment.html>

More information about the ltk-user mailing list