Ltk:ウィジェットスタイルを変更する - lisp-cookbook-ja/common-lisp GitHub Wiki

  • LTKのウィジェットスタイルを変更
;;; LTKのスタイルを設定する

(ql:quickload :ltk)

(defpackage :ltk-style-test
  (:use :common-lisp :ltk)
  (:export :main))

(in-package :ltk-style-test)

(defun pack-quit-button ()
  (pack (make-instance 'button
                       :text "Quit"
                       :command (lambda ()
                                  (setf *exit-mainloop* t)))))

(defun theme-names ()
  (send-wish "senddatastrings [ttk::style theme names]")
  (ltk::read-data))

(defun use-theme (name)
  (format-wish "ttk::style theme use ~A" name))

(defun main ()
  (with-ltk ()
    (wm-title *tk* "LTK STYLE TEST")
    (let ((fradio (make-instance 'frame)))
      (pack fradio :side :top :fill :x)
      (pack (mapcar (lambda (name)
                      (make-instance 'radio-button 
                                     :master fradio
                                     :text name
                                     :value name
                                     :variable (gensym "radio_button")
                                     :command #'use-theme))
                    (theme-names))
            :side :left)
      (pack-quit-button))))

;;; 実行
(main)