Hi Everett,
I have to say, from the general style your code basically looks like the code I would write. Just a few comments, none of them ltk related:
- you set some variables, but never define them, rather use let* - what lisp are you using, SBCL has pi defined as a constant? - and the biggest one: DON'T use read on user input carelessly, try for example entering #.(do-msg "huch!") instead of a number and press calculate... read allows for evaluation of arbitrary lisp code.
Of course, the dialog layout could be different, but thats just fiddling a bit with the options of pack...
So the code could look like:
(defun circularea () (with-ltk (:debug-tcl nil) (wm-title *tk* "circularea") (let* ((label-d (make-instance 'label :text "A circle with a diameter of ")) (entry-d (make-instance 'entry :text "0")) (label-u (make-instance 'label :text "units")) (label-a (make-instance 'label :text "has an area of ")) (label-r (make-instance 'label :text "0")) (label-su (make-instance 'label :text "square units")) (b (make-instance 'button :text "calculate" :command (lambda () (let* ((diameter (let ((*read-eval* nil)) (read-from-string (text entry-d)))) (radius (/ diameter 2)) (area (* pi (* radius radius)))) (setf (text label-r) area)))))) (pack label-d) (pack entry-d) (pack label-u) (pack label-a) (pack label-r) (pack label-su) (pack b) )))
Peter