Skip to content
This repository was archived by the owner on Oct 26, 2023. It is now read-only.

Commit de335eb

Browse files
committed
examples: use timer% for close window example
Using a timer% instead of a thread ensures that the eventspace doesn't stop prematurely.
1 parent 424ad3b commit de335eb

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

examples/close-window.rkt

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
#lang racket/base
22

33
(require racket/class
4+
(prefix-in gui: racket/gui)
45
racket/gui/easy
56
racket/gui/easy/operator)
67

78
(define/obs @visible? #t)
9+
810
(render
911
(window
1012
#:mixin (λ (%)
@@ -18,7 +20,8 @@
1820
"Hide temporarily..."
1921
(λ ()
2022
(@visible? . := . #f)
21-
(thread
22-
(λ ()
23-
(sleep 5)
24-
(@visible? . := . #t)))))))
23+
(new gui:timer%
24+
[interval 5000]
25+
[just-once? #t]
26+
[notify-callback (lambda ()
27+
(@visible? . := . #t))])))))

0 commit comments

Comments
 (0)