Ticket #1287: HelloCairo.hs

File HelloCairo.hs, 0.5 kB (added by guest, 18 months ago)

Sample program that exhibits the problem

Line 
1import Graphics.UI.Gtk
2import Graphics.Rendering.Cairo
3
4main :: IO ()
5main = do
6    initGUI
7    window      <- windowNew
8    drawingArea <- drawingAreaNew
9    containerAdd window drawingArea
10
11    drawingArea `onExpose` (\_ -> renderScene drawingArea)
12    window `onDestroy` mainQuit
13
14    windowSetDefaultSize window 640 480
15    widgetShowAll window
16    mainGUI
17
18renderScene :: DrawingArea -> IO Bool
19renderScene da = do
20  dw <- widgetGetDrawWindow da
21  putStrLn "HI!"
22  renderWithDrawable dw $ return () --moveTo 200 200 >> lineTo 0 0 >> stroke
23  return True