(defun hello-2() (with-ltk () (let* ((f (make-instance 'frame)) (b1 (make-instance 'button :master f :text "Button 1" :command (lambda () (format t "Button1~&")))) (b2 (make-instance 'button :master f :text "Button 2" :command (lambda () (format t "Button2~&"))))) (pack f) (pack b1 :side :left) (pack b2 :side :left) (configure f :borderwidth 3) (configure f :relief :sunken) )))The example
hello-2
shows how you group 2 buttons within a frame and
configure widgets in general.
The created frame is given as the master parameter to the button creations.
This automatically ensures that the buttons are packed within the frame.
To change the appeareance of the Frame f
, the configure
function is used. This is a very generic function, which can be used
upon any tk object. It takes two arguments, the name of the configuration option
and the value to set into it. The value can be any tk object or any properly
printable Lisp object.
In this case, we set the width of the border of the frame to 3 and make it a sunken border. Other styles would be raised, ridge, groove, flat and solid. For a comprehensive list of configuration options look in the manpage of the tk widgets as well as man options for options shared by all tk widgets.