From: Lyle Johnson Date: 2003-01-28T09:19:12+09:00 Subject: Re: [FXRuby] How to force a paint on a canvas. Steve Tuckner wrote: > I am working on a simple turtle graphics demonstration program that I > can use to give a demonstration to several classes of 1st graders. The > problem I am having is that I can draw on the canvas widget, but I can't > force it repaint after I draw. The canvas code looks like below: There's a reasonably good discussion of this in the FOX FAQ: http://www.fox-toolkit.org/faq.html under the topic "When do I call flush(), forceRefresh(), refresh() and update() after a change?". As Daniel pointed out in his reply, the function you want to call is FXCanvas#update, which should mark the drawing canvas as "dirty" and thus make it a candidate for repainting at some point in the future. Usually, that time "in the future" arrives pretty quickly (as soon as you return to the event loop), but it's an important distinction to note. As the FAQ states, if you want the repaints to take place *immediately*, be sure to follow the call to FXCanvas#update with a call to FXApp#flush. Since a flush() can be expensive, I'd try it without it first to see if you're OK with the delayed results. Hope this helps, Lyle