Illusion of activity
Posted: Tue Dec 18, 2007 12:06 pm
How do I get this code to update every 500 milliseconds...? It only updates when I resize the window. I suppose that check-event doesn't run unless there's a mouse or keyboard event...?
Code: Select all
(load (append (env "NEWLISPDIR") "/guiserver.lsp"))
(define (bar-output point-list)
(set 'x-coord 10 )
(dolist (y point-list)
(gs:fill-rect "bar" x-coord
(- window-height
(int y)) bar-width
(int y))
(inc 'x-coord (+ bar-width 1))))
(gs:init)
(gs:frame 'f 50 50 640 660 )
(gs:set-background 'f 0.1 0.1 0.1)
(gs:canvas 'png)
(gs:set-paint gs:green)
(gs:set-translation 0 400)
(gs:add-to 'f 'png)
(gs:set-visible 'f true)
(set 'number-of-bars 50)
(map set '(x y window-width window-height) (gs:get-bounds 'f))
(set 'bar-width (/ window-width number-of-bars))
(while (gs:check-event 1000)
(bar-output (random 0 window-height number-of-bars))
(sleep 500)
(gs:delete-tag "bar"))