(Warning: I haven't tested this code.)
One thing you could do is add a new message% widget to the frame. For
example, change your callback to the following:
;; button callback:
(lambda (b e)
;; creating the widget has the side effect of adding it
;; to the parent container (gamew)
(new message%
(parent gamew)
(label (format "Rolled a ~s" (nrandom 3))))
(void))
Adding a new widget to the game frame may change its size or layout. You
can control layout with containers (see pane%, panel%, and their
subclasses).
But message% widgets aren't very flexible in how they display text.
Another thing you could do is add a single editor canvas and write all
of the die-roll messages to its editor. That would look something like this:
;; one text% and editor-canvas% per game frame:
(define t (new text%))
(define ec (new editor-canvas% (parent gamew) (editor t)))
;; the button callback:
... (lambda (b e)
(send t insert (format "Rolled a ~s\n" (nrandom 3)))
(void))
You can refine this version by disallowing user edits (see `lock`),
reliably placing the insertion point at the end of the editor before
writing, adding styles to the die roll result, etc. See the text%
documentation.
Ryan