On this page:
8.18
top
up

1Examples Using the GUI ToolboxπŸ”— i

The scriblib/gui-eval library support example evaluations that use racket/gui facilities (as opposed to just racket/draw) to generate text and image results.

The trick is that racket/gui is not generally available when rendering documentation, because it requires a GUI context. Text and image output is rendered to an image file when the MREVAL environment variable is set, so run the enclosing document once with the environment varibale to generate the images. Future runs (with the environment variable unset) use the generated image.

syntax

( gui-interaction datum...)

#:eval+optsthe-evalget-predicate?get-render
get-get-widthget-get-height
datum...)

syntax

( gui-interaction-eval datum...)

#:eval+optsthe-evalget-predicate?get-render
get-get-widthget-get-height
datum...)

syntax

( gui-interaction-eval-show datum...)

#:eval+optsthe-evalget-predicate?get-render
get-get-widthget-get-height
datum...)

syntax

( gui-racketblock+eval datum...)

#:eval+optsthe-evalget-predicate?get-render
get-get-widthget-get-height
datum...)

syntax

( gui-racketmod+eval datum...)

#:eval+optsthe-evalget-predicate?get-render
get-get-widthget-get-height
datum...)

syntax

( gui-def+int datum...)

#:eval+optsthe-evalget-predicate?get-render
get-get-widthget-get-height
datum...)

syntax

( gui-defs+int datum...)

#:eval+optsthe-evalget-predicate?get-render
get-get-widthget-get-height
datum...)
The first option of each of the above is like interaction , etc., but actually evaluating the forms only when the MREVAL environment variable is set, and then in an evaluator that is initialized with racket/gui/base and slideshow.

The second option of each allows you to specify your own evaluator via the the-eval argument and then to specify four thunks that return functions for finding and rendering graphical objects:
  • get-predicate?:(->(->any/cboolean?)) Determines if a value is a graphical object (and thus handled by the other operations)

  • get-render:(->(->any/c(is-a?/cdc<%>)number?number?void?)) Draws a graphical object (only called if the predicate returned #t; the first argument will be the value for which the predicate holds).

  • get-get-width:(->(->any/cnumber?)) Gets the width of a graphical object (only called if the predicate returned #t; the first argument will be the value for which the predicate holds).

  • get-get-height:(->(->any/cnumber?)) Gets the height of a graphical object (only called if the predicate returned #t; the first argument will be the value for which the predicate holds).

top
up

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /