|(require htdp/gui)||package: htdp-lib|
The teachpack provides functions for creating and manipulating graphical user interfaces. We recommend using 2htdp/universe instead.
Window A Window is a data representation of a visible window on your computer screen.
GUI-ITEM A GUI-Item is a data representation of an active component of a window on your computer screen.
> (define w (create-window (list (list (make-button "QUIT" (lambda (e) (hide-window w))))))) ; A button appears on the screen. ; Click on the button and it will disappear. > (show-window w) ; The window disappears.
; 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 (define w (create-window (list (list text1) (list msg1) (list (make-button "OKAY" respond) (make-button "QUIT" (lambda (e) (hide-window w)))))))