How to resolve the algorithm Hello world/Graphical step by step in the Common Lisp programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Hello world/Graphical step by step in the Common Lisp programming language
Table of Contents
Problem Statement
Display the string Goodbye, World! on a GUI object (alert box, plain window, text area, etc.).
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Hello world/Graphical step by step in the Common Lisp programming language
Source code in the common programming language
(use-package :ltk)
(defun show-message (text)
"Show message in a label on a Tk window"
(with-ltk ()
(let* ((label (make-instance 'label :text text))
(button (make-instance 'button :text "Done"
:command (lambda ()
(ltk::break-mainloop)
(ltk::update)))))
(pack label :side :top :expand t :fill :both)
(pack button :side :right)
(mainloop))))
(show-message "Goodbye World")
(in-package :clim-user)
(defclass hello-world-pane
(clim-stream-pane) ())
(define-application-frame hello-world ()
((greeting :initform "Goodbye World"
:accessor greeting))
(:pane (make-pane 'hello-world-pane)))
;;; Behaviour defined by the Handle Repaint Protocol
(defmethod handle-repaint ((pane hello-world-pane) region)
(let ((w (bounding-rectangle-width pane))
(h (bounding-rectangle-height pane)))
;; Blank the pane out
(draw-rectangle* pane 0 0 w h
:filled t
:ink (pane-background pane))
;; Draw greeting in center of pane
(draw-text* pane
(greeting *application-frame*)
(floor w 2) (floor h 2)
:align-x :center
:align-y :center)))
(run-frame-top-level
(make-application-frame 'hello-world
:width 200 :height 200))
You may also check:How to resolve the algorithm Determine if only one instance is running step by step in the FreeBASIC programming language
You may also check:How to resolve the algorithm Caesar cipher step by step in the zonnon programming language
You may also check:How to resolve the algorithm Factorial step by step in the Zig programming language
You may also check:How to resolve the algorithm Largest int from concatenated ints step by step in the Phix programming language
You may also check:How to resolve the algorithm Hello world/Web server step by step in the zkl programming language