From: Daniel W. <da...@wa...> - 2014-03-24 18:22:42
|
I don't know much about gtk3, but I expect there is not a way to draw directly on a drawing area. Instead, ask the drawing area to trigger the draw event; there were a lot of ways to do this in gtk2, and it seems most of them still exist in the gtk3 package. You might want to start reading at http://hackage.haskell.org/package/gtk3-0.12.5.6/docs/Graphics-UI-Gtk-Abstract-Widget.html#v:widgetQueueDraw and click cross-referencing links to read about the related functions. ~d On 2014-03-24 11:47, Daniel Díaz Casanueva wrote: > Hi gtk folks. > > I am writing an application using gtk3. At this point, I want to > define a function that draws a picture in a canvas using cairo. What I > have done so far is: > > * Created a new DrawingArea with "drawingAreaNew". > * Created a "Render ()" value, which contains the directives to draw > the picture. > > What I need to know is how to join these two pieces so the picture is > drawn in the DrawingArea. I tried to use "renderWithDrawWindow", but > it requires a DrawWindow as argument instead of a DrawingArea. > However, there is no method to create a DrawWindow in gtk3. It seems > this was different in the gtk package. How is this accomplished now? I > have seen examples in the GitHub repo, but all the drawing seems to be > associated with a "draw" event (see [1]), and I can't see how to do it > outside the "draw" event. The picture I want to render will change > over time, so I want to have a procedure to update it by myself. > > Thank you in advance for any help in this regard. > Daniel Díaz. > > [1] > - https://github.com/gtk2hs/gtk2hs/blob/master/cairo/demo/DrawingGtk3.hs > [1] > > Links: > ------ > [1] > https://github.com/gtk2hs/gtk2hs/blob/master/cairo/demo/DrawingGtk3.hs > > ------------------------------------------------------------------------------ > Learn Graph Databases - Download FREE O'Reilly Book > "Graph Databases" is the definitive new guide to graph databases and > their > applications. Written by three acclaimed leaders in the field, > this first edition is now available. Download your free book today! > http://p.sf.net/sfu/13534_NeoTech > > _______________________________________________ > Gtk2hs-users mailing list > Gtk...@li... > https://lists.sourceforge.net/lists/listinfo/gtk2hs-users |