hello-color.scm (962B)
1 ; PS/Tk Example Program "Hello World Color" 2 ; Copyright (C) 2021-2022 Daniil Archangelsky aka Kiky Tokamuro 3 ; Copyright (C) 2006 Nils M Holm 4 ; See the PS/Tk license for conditions of use. 5 6 (add-to-load-path 7 (string-append 8 (dirname (current-filename)) 9 "/../")) 10 11 (use-modules (pstk)) 12 13 (tk-start) 14 (let* ((label (tk 'create-widget 'label 'height: 5 15 'text: "Hello, World!" 'font: "Helvetica 20" 16 'fg: "#ffff00" 'bg: "#a00000")) 17 (change-color 18 (lambda () 19 (let ((c (tk/choose-color))) 20 (cond ((not (string=? c "")) 21 (label 'configure 'bg: c)))))) 22 (bt-color (tk 'create-widget 'button 23 'text: "New Color" 24 'command: change-color)) 25 (bt-quit (tk 'create-widget 'button 26 'text: "Goodbye" 27 'command: tk-end))) 28 (tk/pack label 'side: 'top 'expand: #t 'fill: 'x) 29 (tk/pack bt-color bt-quit 'side: 'left 'expand: #t 'fill: 'x) 30 (tk-event-loop))