[Haskell-cafe] Re: Bouncing ball in Gtk2Hs

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Fri Mar 23 21:03:18 EDT 2007


On Fri, 2007-03-23 at 20:24 +0300, Thach Si Lam wrote:

> I'm trying to write Bouncing Ball demo in Gtk2hs. But i coudn't find
> timer class (like in wxhaskell demo) in Gtk2hs.

There is timeoutAdd:

http://haskell.org/gtk2hs/docs/gtk2hs-docs-0.9.10/System-Glib-MainLoop.html#v%3AtimeoutAdd

used like so:
  
timeoutAdd action 1000

where action is an action with type IO Bool and the number is the time
to wait in milliseconds, (ie 1000 is 1 second). If the action returns
True then it will get called again at the next timeout, otherwise it
will not be called again.

> How to deal with it ? In fact i have 2 processes: p1 for computing
> some variables and p2 for changing (applying those variables) in
> canvas. How to let them communicate together and update to canvas ?
> Please, help me. Thank you very much. 

I'm forwarding this to the Haskell Cafe mailing list where someone might
be able to give you a pointer.

Duncan



More information about the Haskell-Cafe mailing list