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