[pygtk] Drawing point,rectangle etc over png using Cairo
A.T.Hofkamp
a.t.hofkamp at tue.nl
Wed Dec 2 00:03:23 WST 2009
nipun batra wrote:
> Ok Thanks for explaining this concept.But now what is the best solution assuming i will be
> needing new set of say rectangles to be plotted every timer cycle,more than 100 a second.
Your monitor probably does 50 or 60 cycles at most, the human eye is even much less fast.
I believe that 100 times/second update is completely unneeded even if the computer can do that.
So decouple both, have an asynchronous loading of new points (eg via gobject), and adding them to
the list, marking dirty, and handling refresh requests.
It may be that the app decides to keep itself busy with loading new points all the time, and never
redraws the picture. You could do something like loading only while the app is idle or so in that
case (gobject can give you call when the app is idle). Never done that kind of thing.
> Also I have no idea on how to integrate this widget with other standard widgets like buttons,text area etc.
Make a class derived from gtk.DrawingArea with your code in it.
Since gtk.DrawingArea is a widget, your class is also a widget. You can use it just like any other
widget, you can pack it in vbox or hbox, etc etc, as explained in the tutorial.
Albert
More information about the pygtk
mailing list