Package: gtk
Macro within-main-loop
Lambda Listwithin-main-loop (&body body) Details The within-main-loop macro is a wrapper around a GTK program. The functionality of the macro corresponds to the gtk_init() and gtk_main() C functions which initialize and start a GTK program. Both functions have corresponding Lisp functions. The gtk_main() function is exported as the gtk-main Lisp function. The corresponding Lisp function to the gtk_init() function is called internally when loading the
library, but is not exported. To stop the execution of the main loop the leave-gtk-main function is called. Example
(defun example-simple-window ()
(within-main-loop
(let (;; Create a toplevel window.
(window (gtk-window-new :toplevel)))
;; Signal handler for the window to handle the signal "destroy".
(g-signal-connect window "destroy"
(lambda (widget)
(declare (ignore widget))
(leave-gtk-main)))
;; Show the window.
(gtk-widget-show-all window)))) | See also |
*2021-11-13