Hi All, I was playing around with creating a progress bar. The basic idea was straightforward.
#lang racket/gui (define frame (new frame% [label "Progress Bar"] [width 300])) (define hpane (new horizontal-pane% [parent frame])) (define gauge (new gauge% [label ""] [parent hpane] [range 100])) (define msg (new message% [parent hpane] [auto-resize #t] [label "0%"])) (send frame show #t) (for ([i (in-range 1 101)]) (sleep 0.05) (send gauge set-value i) (send msg set-label (string-append (~a i) "%"))) When I tried to take the next step of wrapping this up into a couple of functions, I was completely lost. I don't know how to initialize a frame with child elements by calling a function because all of the elements of the frame only exist in the function and not at the top-level (probably butchering the jargon here; hopefully it makes sense). I wasn't really sure where to look to learn more about doing such a thing. Here is some pseudocode to try to further illustrate my confusion. (define (initialize-progress-bar) ;; insert code that creates progress bar ;; i.e., from defining frame to sending frame in code above) (define (update-progress-bar new-value) (send gauge set-value new-value) (send msg set-label (string-append (~a new-value) "%"))) (initialize-progress-bar) (for ([i (in-range 1 101)]) (sleep 0.05) (update-progress-bar i)) Thanks, Travis -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/61a3ea75-d285-45d1-90d4-de569c441c8d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.