How to change the title of the root window?

Volker vos at lundinova.se
Thu Jun 21 09:48:57 UTC 2018


On 06/21/18 09:59, Volker wrote:
> I'm trying to get started with ltk and of cause running into many
> problems. One is: how do I change the title of the root window (it is
> "LTK" as default).
>
> The corresponding python code would be:
>
> root = Tk()
> root.title("Hello, world")
>
>
> This was one of my many unsuccessful tries:
>
> (defun how-to-set-title ()
>   (ltk:with-ltk ()
>     (let* ((root (make-instance 'ltk:widget :name "." :path "."))
>            (b (make-instance 'button
>                              :master nil
>                              :text "Press Me"
>                              :command (lambda ()
>                                         (format t "Hello World!~&")))))
>       (setf (title root) "My app")
>       (pack b))))

Ok, found it! This works:

(defun how-to-set-title-1 ()
   (ltk:with-ltk ()
     (let* ((root (make-instance 'ltk:widget :name "." :path "."))
            (b (make-instance 'button
                              :master nil
                              :text "Press Me"
                              :command (lambda ()
                                         (format t "Hello World!~&")))))
       (ltk:wm-title root "My App")
       (pack b))))

Volker




More information about the ltk-user mailing list