gui.ss
The teachpack gui.ss
provides the following operations:
Example 1:
> (create-window (list (list (make-button "QUIT" hide-window))))
A button appears on the screen. Click on the button and it will disappear.
> (show-window)
The frame reappears.
Example 2:
; text1 : GUI-ITEM
(define text1
(make-text "Please enter your name"))
; msg1 : GUI-ITEM
(define msg1
(make-message (string-append "Hello, World" (make-string 33 #\SPACE))))
; Event -> true
; draws the current contents of text1 into msg1, prepended with "Hello, "
(define (respond e)
(draw-message msg1 (string-append "Hello, " (text-contents text1))))
; set up window with three "lines": a text field, a message, and two buttons
; fill in text and click OKAY
(create-window
(list
(list text1)
(list msg1)
(list (make-button "OKAY" respond)
(make-button "QUIT" hide-window))))