[pygtk] Drawing point,rectangle etc over png using Cairo

nipun batra nipunreddevil at gmail.com
Tue Dec 1 23:07:18 WST 2009


On Tue, Dec 1, 2009 at 4:51 PM, A.T.Hofkamp <a.t.hofkamp at tue.nl> wrote:

> nipun batra wrote:
>
>> Thanks
>> This is my expose event function
>>
>> def expose(self, widget, event):
>>
>> cr = widget.window.cairo_create()
>> cr.set_source_surface(self.surface, self.border, self.border)
>> cr.paint()
>> cr.set_source_rgb(0.5, 0, 0)
>>
>> #cr.paint()
>> cr.rectangle(int(var1)*10,int(var2)*10,5,5)
>> cr.fill()
>>
>> Here i am initially drawing the background image and over it i am drawing
>> points.These come from two variables(global) which are updated every clock
>> cycle.Now maintaining a list and plotting it would be tedious and not at all
>> processor friendly.Could you elaborate a bit on the other technique.Using
>> "dirty" regions.
>> Thanks in advance
>>
>>
> I think compared to drawing an image, drawing a few points seems not
> relevant.
>
> I never used regions, but the idea is to mark an area as 'dirty' (eg the
> area containing the new point). Then you will automatically get an expose
> event, with the area that must be redrawn (probably somewhere in the 'event'
> parameter).
> You can skip drawing all points that are outside that area.
>





Ok..My code will be redrawing the background image apparently which is
unneccesary.Still not clear with the dirty area concept.Can someone provide
an example.Also how to integrate this widget as a part of a larger
application using sizers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20091201/a82168ce/attachment.htm 


More information about the pygtk mailing list