[pygtk] Cairo drawing problems

Adam Schreiber sadam at gnome.org
Wed May 13 22:52:20 WST 2009


On Wed, May 13, 2009 at 10:33 AM, Ettore Virzi <ettore.virzi at unimib.it> wrote:
> Il giorno gio, 30/04/2009 alle 21.53 -0400, Adam Schreiber ha scritto:
>
>> Is there anyone that's taken a look at this or at least run the
>> example code I provided?
> Hi,
>  I've only had a look at the first attachment.
> The problem is for sure in the use of the 'get_allocation' result.
> rect.x refers to  the parent's widget coordinates.
> Try to draw with:
>        context.rectangle(gtk.gdk.Rectangle(rect.width/3,
>                                            5,
>                                            rect.width/3,
>                                            rect.height - 10))
>
> When you draw in your DrawingArea you must use its coordinate system (which starts from 0)

Thanks for the response.  I filed bugs and that's the solution that we
came up with.  The long term solution is that the tutorial at

http://www.pygtk.org/articles/cairo-pygtk-widgets/cairo-pygtk-widgets.htm

and others like it need to be updated to remove references to the
parent widget's coordinates.

Cheers,

Adam

>
>> >
>> _______________________________________________
>> pygtk mailing list   pygtk at daa.com.au
>> http://www.daa.com.au/mailman/listinfo/pygtk
>> Read the PyGTK FAQ: http://faq.pygtk.org/
> --
> Ettore Virzi
> ----------------------------------------------
> Universita` degli Studi Milano - Bicocca
> Sistemi Informativi - http://www.si.unimib.it
> Via Cozzi, 53
> 20125 Milano - Italy
>
> ettore.virzi at unimib.it
> phone   +39 0264485537
> fax     +39 0264485550
> ----------------------------------------------
>
>


More information about the pygtk mailing list